Repository navigation
Description
What happens
BeginTransaction, CommitTransaction and RollbackTransaction accept the call, hand out a transaction id and null it again — they never touch a database connection:
src/SharpCoreDB.Server.Core/DatabaseService.cs:592-616—BeginTransactiononly setssession.ActiveTransactionId = Guid.NewGuid().DatabaseService.cs:631—// Transaction commit logic would go here, thensession.ActiveTransactionId = null.DatabaseService.cs:656— same for rollback.ExecuteQuery(DatabaseService.cs:281) andExecuteNonQuery(DatabaseService.cs:443) each take a fresh pooled connection (session.DatabaseInstance.GetConnectionAsync) and never readsession.ActiveTransactionId, so every statement autocommits.- The client cannot enlist either:
NonQueryRequest/QueryRequestcarrysession_id,sql,parameters,timeout_ms— no transaction id (src/SharpCoreDB.Client/SharpCoreDBCommand.cs:68-115).
Reproduction (published artifacts, 2026-12-04)
SharpCoreDB.Client 2.3.2 (nuget.org) against ghcr.io/mpcoredeveloper/sharpcoredb-server:2.3.2, dev TLS cert, gRPC :5001:
OPENED session=… version=2.3.2 token=issued
CREATE TABLE scdms_probe (id INTEGER PRIMARY KEY, note TEXT NOT NULL, score REAL)
INSERT id=1 …; INSERT id=2 … -- 2 rows
begin → INSERT id=3 → COMMIT → COUNT(*) = 3 (correct)
begin → INSERT id=4 → ROLLBACK → COUNT(*) = 4 (row 4 survived the rollback)
So a client that "rolls back" keeps the writes. ExecuteBatch.transactional (proto field 3) is equally meaningless today.
Impact
Any client that offers transactions is lying, and any client that applies a multi-statement change "atomically" (staged grid editing, import, DDL + backfill) cannot recover from a failure halfway. SCDMS (MPCoreDeveloper/SCDMS) therefore keeps sql.transactions and server-side staged editing gated with exactly this reason in its capability contract; the local embedded engine/provider is unaffected (2.3.2 fixed the local commit defect from #546).
Expected
- A session with an active transaction executes subsequent statements on that transaction's connection;
Commitpersists them,Rollbackdiscards them (including after a later select/reopen). - Concurrent sessions must not see uncommitted rows.
- Red→green tests in
ConnectionLifecycleTests/a newTransactionEnlistmentTests, and a live check in the container harness.
Found while moving SCDMS to 2.3.2 (MPCoreDeveloper/SCDMS, commit c327c01); the same probe is reusable as a regression check.
Activity