You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collection-per-file mode: concurrent explicit transactions corrupt the free-space index (IndexOutOfRangeException in SnapshotForTransaction) #325
In collection-per-file mode (CollectionDataDirectory), concurrent explicit transactions on one collection throw IndexOutOfRangeException from FreeSpaceIndex.SnapshotForTransaction (src/BLite.Core/Storage/FreeSpaceIndex.cs ~191). The free-space index's Dictionary is mutated concurrently and left inconsistent.
Cause
In that mode the free-space index is used without its _gate, and its OnCommit/OnRollback handlers run outside the collection lock, so two transactions read and write the same Dictionary at once.
Repro
8 writers × 50 explicit transactions (begin, insert, commit) into one collection of an engine opened with CollectionDataDirectory: 20 of 400 transactions throw IndexOutOfRangeException on main 3648a02. Single-file mode is not affected. Found during the review of #310, which does not cause it (6–37 of 400 with that PR applied).
Expected
No exception; the free-space index is updated under the same synchronisation as in single-file mode.
Activity