Share FreeSpaceIndex in single-file mode and make insert-side FSI updates rollback-safe#68
Conversation
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/baca82e5-93bf-4f92-b843-2b86450c98aa Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/baca82e5-93bf-4f92-b843-2b86450c98aa Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
mrdevrobot
left a comment
There was a problem hiding this comment.
Please review comments there is a missing else statement that will break the compilation
I reviewed the referenced |
There was a problem hiding this comment.
Pull request overview
This PR updates free-space tracking so that (1) FreeSpaceIndex instances are shared across collections/sessions in single-file (embedded) mode, and (2) insert-side FreeSpaceIndex updates are made rollback-safe via per-transaction snapshots and rollback/commit hooks.
Changes:
- Introduces
FreeSpaceIndexProviderto supply a shared FSI in single-file mode and per-collection FSIs in multi-file mode. - Adds per-transaction snapshot/rollback/commit handling to
FreeSpaceIndex, and wires snapshotting into insert/allocation paths inDocumentCollectionandDynamicCollection. - Adds regression tests covering FSI sharing and rollback behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/BLite.Tests/FreeSpaceIndexTests.cs | Adds unit tests validating snapshot + rollback behavior in FreeSpaceIndex. |
| tests/BLite.Tests/DocumentCollectionTests.cs | Adds regression tests for shared FSI behavior and rollback-safe inserts. |
| src/BLite.Core/Storage/StorageEngine.cs | Exposes UsesSeparateCollectionFiles to let higher layers choose FSI sharing strategy. |
| src/BLite.Core/DynamicCollection.cs | Allows injecting an FSI and snapshots FSI changes for rollback/commit around insert/allocation. |
| src/BLite.Core/DocumentDbContext.cs | Creates and reuses FreeSpaceIndexProvider; passes FSIs into collections/sessions. |
| src/BLite.Core/Collections/FreeSpaceIndexProvider.cs | New provider that shares an FSI in single-file mode (and serializes access). |
| src/BLite.Core/Collections/FreeSpaceIndex.cs | Adds transaction snapshots and optional serialized access for shared use. |
| src/BLite.Core/Collections/DocumentCollection.cs | Allows injecting an FSI and snapshots FSI changes for rollback/commit across write paths. |
| src/BLite.Core/BLiteSession.cs | Plumbs FreeSpaceIndexProvider into session-created dynamic collections. |
| src/BLite.Core/BLiteEngine.cs | Owns FreeSpaceIndexProvider and shares it with sessions/collections. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/ca11b822-e9a9-4ac5-b1dc-eb94e632bc4e Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Applied the review-thread change in |
FreeSpaceIndex.EnterGate()to use fully synchronous gate acquisitionFreeSpaceIndexchange