GO-6331 objectstorestore remove on space leave#2886
Open
requilence wants to merge 5 commits intodevelopfrom
Open
GO-6331 objectstorestore remove on space leave#2886requilence wants to merge 5 commits intodevelopfrom
requilence wants to merge 5 commits intodevelopfrom
Conversation
deff7
reviewed
Jan 12, 2026
| } | ||
|
|
||
| func (p *storeProxy) SubscribeForAll(callback func(rec database.Record)) { | ||
| // Store the callback in the proxy so it survives until dsObjectStore is created. |
Member
There was a problem hiding this comment.
why this is required? In order for subscriptions to work we need to re-run initial subscription query, not only register a callback
deff7
approved these changes
Jan 12, 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.
PR Description
TL;DR
Problem: When a user was kicked from a space (by another participant), the cleanup only removed ACL indexes via
cleanACLIndexes()but left the space database files on disk. The space data was never fully removed.Solution: Introduce proper space index lifecycle management tied to space mode transitions:
OnSpaceModeChangehook triggersCloseSpaceIndex()when space entersOffloadingmodeDeleteSpaceIndex()permanently deletes the database files from filesystem and marks the proxy as deactivatedWhy storeProxy: The proxy pattern was needed to safely handle the "deactivated but still referenced" state. After a space is deleted, existing code paths (like cross-space subscriptions or late callbacks) might still call
SpaceIndex(deletedSpaceId). Without the proxy:anystore.Open()The proxy solves both: it returns
sharedEmptyStorefor deactivated spaces (safe empty results) and theremovedflag prevents re-initialization even ifInit()is called.Key Concepts
initializedremovedErrSpaceRemovedFlow
Syncstatus optimization
AllLoadedSpaceIds()which only returns spaces inModeLoadingstate