commit method

void commit(
  1. TxnContextV2 ctx
)

Implementation

void commit(TxnContextV2 ctx) {
  if (ctx.status != TxnStatus.active) {
    throw StateError('Cannot commit txn ${ctx.txnId}: status=${ctx.status}');
  }
  ctx.status = TxnStatus.committed;
  _active.remove(ctx.txnId);
  committed.markCommitted(ctx.txnId);
  if (ctx.txnId > _lastCommitted) {
    _lastCommitted = ctx.txnId;
  }
  // Release all held locks
  lockManager.releaseAll(ctx.locks);
  ctx.locks.clear();

  // Async: persist the updated committed filter.
  // Non-blocking — durability is already provided by the WAL commit fsync.
  _asyncPersistCommitted();
}