fix(graph): sweep orphan owned-prefix files after leased maintenance - #214
Draft
dyk1454683243-sudo wants to merge 1 commit into
Draft
dyk1454683243-sudo wants to merge 1 commit into
dyk1454683243-sudo wants to merge 1 commit into
Conversation
Remove leftover graph.db.candidate-*, rollback-*, and recovery-* files once a refresh, repair, or rebuild holds the exclusive lease. graph status warns while one is present and does not mutate the tree. Fixes mex-memory#205 Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
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
Interrupted
mex graph rebuildcan leave a full-sizegraph.db.candidate-<token>(and the same forrollback-/recovery-).cleanupOwnedDatabaseonly removes the path the current run created, so a killed process leaked a store-sized file forever.After
acquireGraphMaintenanceLeasesucceeds, refresh / repair / rebuild now readdir.mex/and remove regular files whose basename starts with anOWNED_DATABASE_PREFIXESentry, except the live in-progress candidate for that run (if any). The sweep is exclusive-owner only — it does not run before the lease.mex graph statusis still read-only: it emitsGRAPH_INDEX_ORPHAN_OWNED_DATABASEwhile one of those files is present and does not delete anything.This is independent of stranded-WAL status wording (#204).
Why
Fixes #205
Type of change
How to test
graph.db.candidate-*,graph.db.rollback-*, andgraph.db.recovery-*under.mex/plus an unrelated file.mex graph status— it staysfresh(when the store is) and prints a warning; the files remain.mex graph refresh(orrepair/rebuild) — the owned-prefix leftovers are gone; the unrelated file remains.GRAPH_MAINTENANCE_LOCKEDand the leftovers stay.Checklist
npx vitest run src/graph/__tests__/maintenance.test.ts src/graph/__tests__/status.test.ts— 94 passed, 1 skipped)npm run typecheck)npm test) — full suite not used as a gate hereCode-graph changes
mainLanguageExtractororFrameworkResolverinterfacecore / discuss-firstissue is linked above