Skip to content

fix: proactive FSI revert on transaction rollback#61

Merged
mrdevrobot merged 3 commits intomainfrom
copilot/review-new-info-issue-58
Apr 15, 2026
Merged

fix: proactive FSI revert on transaction rollback#61
mrdevrobot merged 3 commits intomainfrom
copilot/review-new-info-issue-58

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Copilot AI and others added 2 commits April 14, 2026 22:33
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 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 OnCommit transaction lifecycle event and wire FSI snapshot cleanup to OnCommit/OnRollback from DocumentCollection.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.

Comment thread tests/BLite.Tests/InsertBulkTests.cs
Comment thread src/BLite.Core/Transactions/Transaction.cs Outdated
Comment thread src/BLite.Core/Transactions/ITransaction.cs Outdated
@mrdevrobot
Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot apply changes based on the comments in this thread

Done in d5f335a:

  • OnCommit removed from ITransaction — kept only on the concrete Transaction class to avoid a breaking change to the public interface.
  • DocumentCollection.DeleteCore casts to Transaction before subscribing to OnCommit.
  • Both OnCommit and OnRollback are now invoked best-effort via GetInvocationList() with a per-handler try/catch, so a failing handler neither surfaces as a commit/rollback failure nor prevents subsequent handlers from running.

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:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from mrdevrobot April 15, 2026 12:10
@mrdevrobot mrdevrobot marked this pull request as ready for review April 15, 2026 19:17
@mrdevrobot mrdevrobot merged commit 957629c into main Apr 15, 2026
1 check passed
@mrdevrobot mrdevrobot deleted the copilot/review-new-info-issue-58 branch April 15, 2026 19:17
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.

3 participants