Class TransactionManager

java.lang.Object
dev.frostlake.transaction.TransactionManager

public class TransactionManager extends Object
  • Constructor Details

  • Method Details

    • setStreamManager

      public void setStreamManager(StreamManager streamManager)
      Wire the engine's StreamManager so committed deferred changes emit CDC events at apply time.
    • setWalSink

      public void setWalSink(WalSink walSink)
      Wire the engine's write-ahead log so a committed transaction's statements are made durable on commit (null when durability.walEnabled is off, in which case nothing is logged).
    • beginTransaction

      public Transaction 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

      public void beginExplicitTransaction(String name)
      As beginExplicitTransaction(), 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 with clearSessionAutoCommit().
    • clearSessionAutoCommit

      public void clearSessionAutoCommit()
      End this thread's autocommit scope (idempotent). Read the final value via isAutoCommit() 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

      public void discardBufferedWritesFor(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. 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

      public void setSessionContext(SessionContext sessionContext)
      Wire the owning session so LAST_TRANSACTION can answer the completed id.
    • commit

      public void commit()
    • rollback

      public void rollback()
    • setSavepoint

      public void setSavepoint(String name)
    • rollbackToSavepoint

      public void rollbackToSavepoint(String name)
    • releaseSavepoint

      public void releaseSavepoint(String name)
    • getCurrentTransaction

      public Transaction getCurrentTransaction()
    • hasActiveTransaction

      public boolean hasActiveTransaction()
    • setCurrentTransaction

      public void setCurrentTransaction(Long transactionId)
    • getActiveTransactions

      public Collection<Transaction> getActiveTransactions()
    • getCurrentTransactionId

      public Long getCurrentTransactionId()