Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data recovery: repair node #142

Merged
merged 4 commits into from
Aug 22, 2022
Merged

Data recovery: repair node #142

merged 4 commits into from
Aug 22, 2022

Conversation

appy-one
Copy link
Owner

@appy-one appy-one commented Aug 22, 2022

If a database suffers from data corruption, it is important to investigate why this happens: this is usually because of unsafe simultanious multi-process access. See #48 How to protect your database from corruption
However - in the unfortunate event of data corruption, this new feature provides a way to manually repair a broken node.

When using AceBase's own binary storage engine, it is now possible to run await db.recovery.repairNode("path/to/broken/node"). Doing so will remove or replace the reference to it from the parent node. It does not overwrite the target record to prevent possibly breaking other data.

This provides a fix for TypeError: Unknown chunk type 91 while reading record at (...)

Examples:

await db.recovery.repairNode("books/book1/title"); // replaces title with string "[[removed]]"
await db.recovery.repairNode("books/book1/title", { markAsRemoved: false });  // removes title property from book1

Recommended: backup your data before performing repairs

@appy-one appy-one merged commit 4415fa4 into master Aug 22, 2022
@appy-one appy-one deleted the recovery/repair-node branch August 22, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant