Repository navigation
nodestorage: IndexSpace releases the storage - #244
Merged
Merged
Conversation
IndexSpace returned an acquired SpaceStorage that the repairer and resharder discarded, so the container kept handlers > 0 and the storage cache never evicted it: the db stayed open and TryLockAndOpenDb reported the space as locked forever. IndexSpace closes the storage itself and returns only an error.
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
The hash and nodehead are already written by then, so a release error must not make callers treat an indexed space as failed. The test evicts through the cache instead of closing the container directly.
The migrator repeated the IndexSpace body and never closed the acquired storage, pinning every migrated space in the storage cache.
Bulk callers (startup indexing, repairer, resharder) would otherwise keep every indexed db open until the cache gc. A storage held by someone else stays in the cache. Startup indexing no longer calls ForceRemove, which closed the db regardless of other holders.
ocache.TryRemove has no guard for an entry that is still loading and closes an idle container under a concurrent opener, so IndexSpace only releases its handle. A released storage is evicted by the gc within the cache ttl.
requilence
self-requested a review
September 19, 2026 13:52
requilence
approved these changes
Sep 19, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
IndexSpacereturns an acquiredSpaceStorage. The repairer and resharder discard it, so the storage container keepshandlers > 0and the storage cache never evicts it. Each such space keeps its db open for the process lifetime andTryLockAndOpenDbreports it as locked, so it can never be archived.With a failing archive upload this compounds: the archiver marks a space
Erroreach check, the repairer "repairs in place" viaIndexSpaceand pins it. The archiver then re-scans a growing list of locked spaces on every check, which shows up as periodic CPU spikes on an idle node.Change
IndexSpacecloses the storage itself and returns only an error. Callers and the mock are updated;nodehead.ReloadHeadFromStoreno longer closes it by hand. A close failure is logged, not returned, since the index is already written by then.The migrator indexes migrated spaces through
IndexSpaceinstead of repeating its body without a release.Tests
TestStorageService_IndexSpacecovers: index written and storage released,setHead, a storage held elsewhere stays open and usable, and release on the error path.🤖 Generated with Claude Code