Repository navigation
Backlog
Labels
area:serverSharpCoreDB.Server and server core
Description
Context
#563 (fixed on master, unreleased) showed that one abandoned client could disable transactions for the whole server process. The leak is fixed: every session-removal path now rolls the storage transaction back (SessionManager.RemoveSessionAsync), and SessionReaperService schedules the 30-minute expiry sweep that nothing called before.
This issue tracks the remaining "ideally" from #563: two sessions should be able to hold independent transactions at the same time. Today they cannot, and it is not a flag move.
Why it is not a flag move
DatabaseInstancecreates oneSharpCoreDB.Database; theConnectionPoolhands outPooledConnections that all point at it — a "connection" is a pool slot, not an independent engine instance.- The storage layer is single-transaction by construction:
Services.Storageowns oneTransactionBuffer+transactionLock;DirectoryStorageProvider/SingleFileStorageProvidereach carry one_isInTransaction;WalManager.BeginTransaction()throws"Transaction already in progress"when one is open. Table.*readsengine.IsInTransaction/storage.IsInTransactionto decide whether to wrap its own work, so a transaction is a global, non-reentrant resource per database._batchUpdateActive(Database.BatchUpdateTransaction.cs) is an extra, path-keyed layer on top; moving it to the session/connection would not enable concurrent transactions.
Options
- B1 — server-side transaction coordinator (recommended first step): per-session logical transaction with per-session write buffering + read-your-writes, atomically applied under the global storage transaction on commit. No storage-engine change; sessions can be open concurrently.
- B2 — true concurrent storage transactions: per-session
Storage/IStorageProvider/WalManagerhandles merged on commit (shared file lock + conflict detection) or a multi-version WAL. Large, high-risk; touches WAL semantics, crash consistency and the reopen matrix (the hard rails inAGENTS.md/ brief §11).
Full analysis: docs/server/PER_SESSION_TRANSACTION_ISOLATION.md.
Acceptance (B1)
- Two sessions can each call
BeginTransactionand hold it concurrently. - A session reads only committed state plus its own buffer;
Commitis atomic and serialized;Rollbackdiscards the buffer. - A vanished session still releases its transaction (the An abandoned session keeps the storage transaction open, so every later BeginTransaction fails with "Batch update already active" #563 guarantee holds).
ReopenRoundTripMatrixTests,FormatCompatPolicyTests, the fixed-width canaries and the write-path gate stay green; the non-transactional path is unchanged.
Not in scope
Do not change the single-file/directory durability contract. Do not trade encryption or WAL semantics.
Metadata
Metadata
Assignees
Labels
area:serverSharpCoreDB.Server and server core
Activity