[PR #142] [MERGED] Data recovery: repair node #126

Closed
opened 2026-05-23 08:31:23 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/appy-one/acebase/pull/142
Author: @appy-one
Created: 8/22/2022
Status: Merged
Merged: 8/22/2022
Merged by: @appy-one

Base: masterHead: recovery/repair-node


📝 Commits (4)

  • d1eb102 New recovery feature: repairNode (undocumented)
  • 1f3d58a repairNode unit test
  • dec95bb fix: nodeLocker access modifier must be protected
  • 9cf8454 chore: build

📊 Changes

7 files changed (+243 additions, -3 deletions)

View changed files

📝 dist/browser.js (+8 -0)
📝 dist/browser.min.js (+1 -1)
spec/recovery.spec.js (+77 -0)
📝 src/acebase-local.js (+8 -0)
📝 src/storage-acebase.js (+144 -0)
📝 src/storage/index.d.ts (+4 -1)
📝 src/ts/storage/index.ts (+1 -1)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/appy-one/acebase/pull/142 **Author:** [@appy-one](https://github.com/appy-one) **Created:** 8/22/2022 **Status:** ✅ Merged **Merged:** 8/22/2022 **Merged by:** [@appy-one](https://github.com/appy-one) **Base:** `master` ← **Head:** `recovery/repair-node` --- ### 📝 Commits (4) - [`d1eb102`](https://github.com/appy-one/acebase/commit/d1eb1020d3cbd6c4b082d30b654a22bbfcae4997) New recovery feature: repairNode (undocumented) - [`1f3d58a`](https://github.com/appy-one/acebase/commit/1f3d58af7c4f7eeb0164690c8e84ee2b96be06b0) repairNode unit test - [`dec95bb`](https://github.com/appy-one/acebase/commit/dec95bbe3fa1bc80e098ac2f9816422b8f5efc44) fix: nodeLocker access modifier must be protected - [`9cf8454`](https://github.com/appy-one/acebase/commit/9cf8454c5f3090ebecadf1bfb92c81ab967587bc) chore: build ### 📊 Changes **7 files changed** (+243 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `dist/browser.js` (+8 -0) 📝 `dist/browser.min.js` (+1 -1) ➕ `spec/recovery.spec.js` (+77 -0) 📝 `src/acebase-local.js` (+8 -0) 📝 `src/storage-acebase.js` (+144 -0) 📝 `src/storage/index.d.ts` (+4 -1) 📝 `src/ts/storage/index.ts` (+1 -1) </details> ### 📄 Description 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](https://github.com/appy-one/acebase/discussions/48) 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 (...)](https://github.com/appy-one/acebase/issues/42) Examples: ```javascript 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-23 08:31:24 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#126
No description provided.