fix(open-knowledge): serialize shadow gc against the write path (#2743)#690
Merged
Conversation
* fix(server): serialize shadow gc against the write path via shadow op gate git gc deletes newly-packed loose objects and emptied objects/xx fan-out dirs; a concurrent git add / hash-object -w writing into those dirs fails transiently (EINVAL observed on macOS, escaping git's ENOENT-only retry). The maintenance coordinator serialized maintenance legs against each other but not against shadow mutators, so a background gc could fail an in-flight flush commit (the A1 flake, 6-14 percent per run measured). Add ShadowOpGate (per shadow gitDir): mutators take shared holds, the gc leg takes an exclusive hold that drains in-flight mutators and briefly queues new ones. Deadlock-free by construction (a pending exclusive never blocks new shared entries, so nested mutator holds cannot deadlock). Wrap every shadow mutation entry point; A2 pins gc against a sustained commit stream. * test(server): review-response hardening for the shadow op gate Address claude-review suggestions on #2743: warn when an exclusive acquisition waits >60s on the mutator drain (starvation observability), document buildWipTree's reliance on the prune grace window across its split gate hold, count actual (not attempted) legacy-ref deletions in sweepLegacyShadowRefs, and add the no-barging top-level-mutator and exclusive-error-release gate tests. GitOrigin-RevId: 90f22c66540c9ce6cf03b7d7ba13f99c000af66d
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.
Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.