Package dev.frostlake.transaction
Class Transaction
java.lang.Object
dev.frostlake.transaction.Transaction
-
Constructor Summary
ConstructorsConstructorDescriptionTransaction(long id, Catalog catalog, StorageEngine storageEngine, StreamManager streamManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()voidcreateSavepoint(String name) Every table lock this transaction holds, whichever apply path recorded it.longgetId()intgetName()The transaction's name, as SHOW TRANSACTIONS reports it: the one BEGIN NAME gave it, or the system-generated UUID when it was opened without one.longgetState()The instants ofgetWalStatements(), in the same order.The mutating statements buffered for the WAL, in execution order (empty when the WAL is off).This transaction's deferred-apply write set (stays empty unless transaction.deferredApply is on).booleanTrue if started by an explicit BEGIN — statement-end autocommit is suspended until COMMIT/ROLLBACK.voidvoidvoidlogStatementForWal(String sql, Instant instant) Record a mutating statement to be written to the WAL (as part of this transaction) on commit, together with the instant it called "now" — statements of one transaction get DIFFERENT instants, so the log keeps one per statement rather than one per record.voidvoidrecordTableTouch(String tableName) Register the PARTITIONS lock a DML touch takes on a table; the first touch wins the cell.voidregisterStreamConsumption(Stream stream, StreamReadScope scope) Register a stream read by a consuming DML in this txn; consumed on commit (scoped to what the read saw — seeStreamReadScope), discarded on rollback.voidreleaseSavepoint(String name) voidrollback()voidrollbackToSavepoint(String name) voidsetExplicit(boolean explicit) voidName this transaction —BEGIN NAME <name>/START TRANSACTION NAME <name>.voidsetState(TransactionState state)
-
Constructor Details
-
Transaction
public Transaction(long id, Catalog catalog, StorageEngine storageEngine, StreamManager streamManager)
-
-
Method Details
-
getId
public long getId() -
getState
-
setState
-
getWriteSet
This transaction's deferred-apply write set (stays empty unless transaction.deferredApply is on). -
logStatementForWal
Record a mutating statement to be written to the WAL (as part of this transaction) on commit, together with the instant it called "now" — statements of one transaction get DIFFERENT instants, so the log keeps one per statement rather than one per record. -
getWalStatements
The mutating statements buffered for the WAL, in execution order (empty when the WAL is off). -
getWalInstants
The instants ofgetWalStatements(), in the same order. -
registerStreamConsumption
Register a stream read by a consuming DML in this txn; consumed on commit (scoped to what the read saw — seeStreamReadScope), discarded on rollback. A re-read replaces the scope: the latest read saw the most, and both parts of the scope only ever grow within a transaction. -
isExplicit
public boolean isExplicit()True if started by an explicit BEGIN — statement-end autocommit is suspended until COMMIT/ROLLBACK. -
setExplicit
public void setExplicit(boolean explicit) -
logInsert
-
logUpdate
-
logDelete
-
getName
The transaction's name, as SHOW TRANSACTIONS reports it: the one BEGIN NAME gave it, or the system-generated UUID when it was opened without one. -
setName
Name this transaction —BEGIN NAME <name>/START TRANSACTION NAME <name>. -
recordTableTouch
Register the PARTITIONS lock a DML touch takes on a table; the first touch wins the cell. -
getAllTableLocks
Every table lock this transaction holds, whichever apply path recorded it. -
commit
public void commit() -
rollback
public void rollback() -
getStartTime
public long getStartTime() -
getLogCount
public int getLogCount() -
createSavepoint
-
rollbackToSavepoint
-
releaseSavepoint
-