Package dev.frostlake.transaction
Class TransactionManager
java.lang.Object
dev.frostlake.transaction.TransactionManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStatement-end autocommit: commit the current implicit transaction, if any.voidEnter a section whose statements must not autocommit the enclosing statement's transaction.voidBegin (or promote the current auto-started) transaction to explicit — an explicit BEGIN suspends statement-end autocommit until COMMIT/ROLLBACK (Snowflake semantics).voidAsbeginExplicitTransaction(), naming the transaction:BEGIN NAME <name>puts that name in SHOW TRANSACTIONS' name cell in place of the UUID an unnamed one carries.voidbeginSessionAutoCommit(boolean value) Begin a per-thread autocommit scope; end it withclearSessionAutoCommit().voidEnd this thread's autocommit scope (idempotent).voidcommit()voiddiscardBufferedWritesFor(String fullyQualifiedTableName) Discard any buffered (uncommitted) writes for a table being dropped or replaced, so a later COMMIT doesn't try to flush them to storage that no longer exists — and so a drop-then-recreate of the same name within one transaction doesn't resurrect the pre-drop rows.voidbooleanbooleanbooleanTrue if an explicit (BEGIN-started) transaction is currently active.voidreleaseSavepoint(String name) voidrollback()voidrollbackToSavepoint(String name) voidsetAutoCommit(boolean autoCommit) voidsetCurrentTransaction(Long transactionId) voidsetSavepoint(String name) voidsetSessionContext(SessionContext sessionContext) Wire the owning session so LAST_TRANSACTION can answer the completed id.voidsetStreamManager(StreamManager streamManager) Wire the engine's StreamManager so committed deferred changes emit CDC events at apply time.voidsetWalSink(WalSink walSink) Wire the engine's write-ahead log so a committed transaction's statements are made durable on commit (null whendurability.walEnabledis off, in which case nothing is logged).
-
Constructor Details
-
TransactionManager
-
-
Method Details
-
setStreamManager
Wire the engine's StreamManager so committed deferred changes emit CDC events at apply time. -
setWalSink
Wire the engine's write-ahead log so a committed transaction's statements are made durable on commit (null whendurability.walEnabledis off, in which case nothing is logged). -
beginTransaction
-
beginExplicitTransaction
public void beginExplicitTransaction()Begin (or promote the current auto-started) transaction to explicit — an explicit BEGIN suspends statement-end autocommit until COMMIT/ROLLBACK (Snowflake semantics). -
beginExplicitTransaction
AsbeginExplicitTransaction(), naming the transaction:BEGIN NAME <name>puts that name in SHOW TRANSACTIONS' name cell in place of the UUID an unnamed one carries. -
isExplicitTransaction
public boolean isExplicitTransaction()True if an explicit (BEGIN-started) transaction is currently active. -
beginSessionAutoCommit
public void beginSessionAutoCommit(boolean value) Begin a per-thread autocommit scope; end it withclearSessionAutoCommit(). -
clearSessionAutoCommit
public void clearSessionAutoCommit()End this thread's autocommit scope (idempotent). Read the final value viaisAutoCommit()first. -
setAutoCommit
public void setAutoCommit(boolean autoCommit) -
isAutoCommit
public boolean isAutoCommit() -
autocommitStatementEnd
public void autocommitStatementEnd()Statement-end autocommit: commit the current implicit transaction, if any. No-op when autocommit is off or an explicit BEGIN suspended it (Snowflake semantics). Call after each completed statement — the top-level engine entry point does, and so does the procedural executor for each statement inside a BEGIN…END body (a stored procedure does NOT wrap its statements in one transaction; leaving the implicit transaction open let a later same-row DELETE consolidate away a buffered INSERT, so append-only streams missed changes that Snowflake captures). -
beginAtomicSection
public void beginAtomicSection()Enter a section whose statements must not autocommit the enclosing statement's transaction. -
endAtomicSection
public void endAtomicSection() -
discardBufferedWritesFor
Discard any buffered (uncommitted) writes for a table being dropped or replaced, so a later COMMIT doesn't try to flush them to storage that no longer exists — and so a drop-then-recreate of the same name within one transaction doesn't resurrect the pre-drop rows. No-op when there is no active transaction or the immediate-apply path left the write set empty. Called from the DROP/CREATE-OR-REPLACE handlers, which remove the storage in the same step. -
setSessionContext
Wire the owning session so LAST_TRANSACTION can answer the completed id. -
commit
public void commit() -
rollback
public void rollback() -
setSavepoint
-
rollbackToSavepoint
-
releaseSavepoint
-
getCurrentTransaction
-
hasActiveTransaction
public boolean hasActiveTransaction() -
setCurrentTransaction
-
getActiveTransactions
-
getCurrentTransactionId
-