Skip to content

Share FreeSpaceIndex in single-file mode and make insert-side FSI updates rollback-safe#68

Merged
mrdevrobot merged 4 commits intomainfrom
copilot/fix-fsi-unattended-exceptions
Apr 23, 2026
Merged

Share FreeSpaceIndex in single-file mode and make insert-side FSI updates rollback-safe#68
mrdevrobot merged 4 commits intomainfrom
copilot/fix-fsi-unattended-exceptions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

  • Inspect the review thread referenced in the new PR comment
  • Update FreeSpaceIndex.EnterGate() to use fully synchronous gate acquisition
  • Run targeted build/tests for the FreeSpaceIndex change
  • Reply to the new PR comment with the fixing commit hash
  • Run final validation for the updated change

Copilot AI and others added 2 commits April 23, 2026 16:34
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/baca82e5-93bf-4f92-b843-2b86450c98aa

Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix unattended exceptions caused by FSI issues Share FreeSpaceIndex in single-file mode and make insert-side FSI updates rollback-safe Apr 23, 2026
Copilot AI requested a review from mrdevrobot April 23, 2026 16:39
Copy link
Copy Markdown
Contributor

@mrdevrobot mrdevrobot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review comments there is a missing else statement that will break the compilation

Comment thread src/BLite.Core/Collections/FreeSpaceIndex.cs
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 23, 2026

Please review comments there is a missing else statement that will break the compilation

I reviewed the referenced FreeSpaceIndex.cs block and rebuilt BLite.Core for both target frameworks; the current branch compiles cleanly. I only see the ambiguous block already discussed on the line comment, so if there’s another exact snippet you want changed, point me to it and I’ll patch it.

Copilot AI requested a review from mrdevrobot April 23, 2026 17:49
@mrdevrobot mrdevrobot requested a review from Copilot April 23, 2026 18:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FreeSpaceIndexProvider to 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 in DocumentCollection and DynamicCollection.
  • 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.

Comment thread src/BLite.Core/Collections/FreeSpaceIndex.cs
@mrdevrobot
Copy link
Copy Markdown
Contributor

@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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Applied the review-thread change in a95514c: FreeSpaceIndex.EnterGate() now uses synchronous SemaphoreSlim.Wait() instead of blocking on WaitAsync(...).GetResult(). Targeted build plus the FreeSpaceIndex test slice are passing on this commit.

@mrdevrobot mrdevrobot marked this pull request as ready for review April 23, 2026 20:36
@mrdevrobot mrdevrobot merged commit f4568b3 into main Apr 23, 2026
1 of 2 checks passed
@mrdevrobot mrdevrobot deleted the copilot/fix-fsi-unattended-exceptions branch April 23, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FSI per collection is creating unattended exceptions

3 participants