Repository navigation
fix(kvdb): continue recovery after unfinished writes - #438
Open
Linjieqiang wants to merge 1 commit into
Open
Linjieqiang wants to merge 1 commit into
Linjieqiang wants to merge 1 commit into
Conversation
未完成写入标记为错误记录后继续扫描,避免遗漏后续待恢复旧值。新增多条未完成记录、跨扇区损坏值与已提交替代值三组回归。
Contributor
Author
|
关联: #437 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
When initialization encounters a
FDB_KV_PRE_WRITErecord, it marks the recordFDB_KV_ERR_HDRand returnstruefromcheck_and_recovery_kv_cb(). Inkv_iterator(),truestops the entire scan._fdb_kv_load()only retries whengc_requestis set, so initialization can return success without recovering laterFDB_KV_PRE_DELETErecords. Valid old values can consequently disappear fromlookups until another initialization.
Continue the current scan after marking an unfinished write. The iterator already
handles invalid CRCs by searching for the next record, and the existing GC retry
path for failed
PRE_DELETErecovery remains unchanged. This adds no allocation,public API, configuration option, or storage format change.
The three registered regression cases create interrupted-write snapshots in the
existing file-backed test database and perform one deinit/init reboot. They cover:
one visible copy and stable results after another reboot.
The fixtures restore complete status tables only on the emulated file medium;
they do not require programming erased bits back to one on physical NOR Flash.
Blob lengths cross the configured write granularity.
Related issue
No issue number assigned yet. The descriptive test names can be updated when an
issue is opened. Reproduced against official master
360a68d0b1f9f02b0d597a9f08c141e28b332c1e.Test closure
tests/fdb_kvdb_tc.c.testcase().cross-sector traversal, blob/write-granularity boundaries, and committed versus
uncommitted replacements. No GC algorithm or init error-policy changes.
host runs with the real FlashDB file backend.
Write granularity covered
the required QEMU/SCons environment is unavailable.
unchanged from the upstream test file, run with MSVC and the real file backend
at 1 / 8 / 32 / 64 / 128 / 256, with KV caching both disabled and enabled
(36 runs before the fix and 36 runs after it).
FlashDB/FAL and the AT32 Flash port at 32 bits, including GC, full 16-model
transactions, reboot/readback and retries. No repeated-init workaround is used.
and real hardware power loss. The targeted host checks do not substitute for CI.
Data layout and compatibility
Power-loss semantics
fdb_kvdb_deinit()->fdb_kvdb_init()reboot simulation.