Fix SQLite writer atomic cache publish#940
Open
WarGloom wants to merge 1 commit into
Open
Conversation
Owner
|
Thanks for the SQLite writer publish fix. Triage: draft high-priority cache/store integrity bug. Review will be cautious because this touches direct DB publication: temp-file atomicity, cleanup on failure, destination WAL/SHM sidecar removal, and live-reader behavior all need explicit tests. Please also rename the PR title before it is ready for review so it describes the change directly. |
123f501 to
82df8c2
Compare
Author
|
Addressed.
Local validation after rebasing onto current
|
Signed-off-by: Nikita Bige <wargloom@gmail.com>
82df8c2 to
076b9a9
Compare
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
-waland-shmsidecars when installing the freshly rebuilt DBRoot Cause
The custom SQLite page writer opened the final cache DB with
fopen(path, "wb"). In shared MCP sessions, that can truncate a live DB while SQLite readers still have the old file mapped, and it can leave old-generation WAL/SHM sidecars beside the rebuilt DB. The observed crash reached SQLitebtreeInitPageduringcbm_store_delete_file_hashesafter the dump/reopen step.Validation
git diff --checkASAN_OPTIONS=detect_leaks=0 build/c/test-runner sqlite_writerASAN_OPTIONS=detect_leaks=0 build/c/test-runner pipelinesrc/pipeline/pass_similarity.c:152make -f Makefile.cbm build/c/codebase-memory-mcpCBM_CACHE_DIR=/tmp/cbm-wiki-mcp-pr-full-20260707-1 build/c/codebase-memory-mcp cli --index-worker index_repository '{"repo_path":"/home/nikita/work/Projects/ai/wiki-mcp"}' --response-out /tmp/cbm-wiki-mcp-pr-full-20260707-1.responsestatus:"indexed",nodes:2256,edges:12934Fixes #897.