fix: proactive FSI revert on transaction rollback#61
Merged
mrdevrobot merged 3 commits intomainfrom Apr 15, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/56fccd3d-1ec0-414c-83e6-6536e1b4af94 Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/56fccd3d-1ec0-414c-83e6-6536e1b4af94 Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
mrdevrobot
April 14, 2026 22:38
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a rollback-induced Free Space Index (FSI) desynchronization by snapshotting per-transaction FSI values before compaction updates and restoring them during transaction rollback, so inserts after a rollback don’t hit stale “optimistic” free-space entries.
Changes:
- Add per-transaction FSI snapshot/restore APIs (
SnapshotForTransaction,RollbackTransaction,CommitTransaction) to proactively revert in-memory FSI state on rollback. - Introduce an
OnCommittransaction lifecycle event and wire FSI snapshot cleanup toOnCommit/OnRollbackfromDocumentCollection.DeleteCore. - Update the regression test to require the first insert after rollback to succeed without a transient exception.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/BLite.Tests/InsertBulkTests.cs | Updates the rollback/FSI regression test to assert insert succeeds on first attempt. |
| src/BLite.Core/Transactions/Transaction.cs | Adds OnCommit event invocation after commit/CDC publication. |
| src/BLite.Core/Transactions/ITransaction.cs | Extends the public transaction interface with OnCommit. |
| src/BLite.Core/Collections/FreeSpaceIndex.cs | Adds transaction snapshot tracking and rollback/commit replay/cleanup. |
| src/BLite.Core/Collections/DocumentCollection.cs | Snapshots FSI before delete compaction updates and subscribes to transaction lifecycle events once per txn. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/EntglDb/BLite/sessions/c711ba97-9829-4d23-86a2-66d4212a1efc Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Contributor
Author
Done in d5f335a:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
mrdevrobot
approved these changes
Apr 15, 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.
InsertBulkAsyncfails with "Not enough space" due to an unrecoverable desync between in-memory FSI and physical page (v4.3) #58 comments and PR fix: correct FSI before throwing "Not enough space" to break poisoned-cache loop #59 (reactive fix already merged)SnapshotForTransaction/RollbackTransaction/CommitTransactiontoFreeSpaceIndexOnCommitevent toTransaction(concrete class only, notITransaction)DocumentCollection.DeleteCore, snapshot FSI before modification and subscribe once per transaction to restore/cleanupOnCommitfrom publicITransaction(breaking change); keep only on concreteTransactionTransactioninDeleteCorebefore subscribing toOnCommitOnCommitandOnRollbackhandlers best-effort (GetInvocationList+ per-handler try/catch)