Repository navigation
fix(chunk_engine): preserve pending removal intent across uncommitted chunk recovery - #462
Merged
SF-Zhou merged 1 commit intoNov 27, 2026
Conversation
… chunk recovery Signed-off-by: bc15575202581 <bc15575202581@gmail.com>
This was referenced Nov 27, 2026
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.
Summary
Persist pending
is_removeintent in thewriting_chunkjournal and restore it during uncommitted chunk recovery (Engine::openandEngine::handle_uncommitted_chunks), preventing aborted or crashed uncommitted removals from resurrecting deleted chunks or creating phantom zero-length chunks.Root Cause
When an uncommitted removal (
UpdateReq { is_remove: true }) is started viaEngine::update_chunk,MetaStore::persist_writing_chunkpreviously serialized onlyChunkMetaandWritingHolderdid not recordis_remove. If the operation aborted or the storage node crashed beforecommit_chunk(s),Engine::handle_uncommitted_chunksreconstructedWritingChunkwithis_remove: false, committing the chunk as a live 0-byte chunk instead of applying the pending deletion.Changes
src/storage/chunk_engine/src/meta/meta_store.rs:UncommittedChunkand append an optional 1-byteWRITING_REMOVE_MARKERtrailer afterChunkMetainpersist_writing_chunkonly whenis_remove == true(preserving exact legacy byte layout for ordinary writes and full backward compatibility on read).query_uncommitted_chunksand carryis_removethroughoccupy_uncommitted_positions/vacate_uncommitted_positions.src/storage/chunk_engine/src/alloc/writing_chunk.rs&src/storage/chunk_engine/src/core/engine.rs:is_removeonWritingHolder.writing_list.remove_writing_chunk_mutinsidecommit_chunks.holder.is_removewhen constructingWritingChunkinhandle_uncommitted_chunks.test_engine_recovers_aborted_uncommitted_removesandtest_engine_recovers_uncommitted_removes_after_reopencovering existing chunk deletion, missing chunk cleanup, overwriting an aborted removal with an ordinary zero-length write, andused_sizeaccounting.Verification
Rebased on
main(cdded47) and ran the fullchunk_engineunit test suite:AI-assisted development disclosure: AI coding tools assisted with root-cause analysis, patch drafting, and regression test authoring; all changes and tests were reviewed and verified locally.