Interface TransactionFactory

All Superinterfaces:
Corruptable
All Known Implementing Classes:
XactFactory

public interface TransactionFactory extends Corruptable
This module is intended to be used only within the RawStore. RawStore functionality is accessed only through the RawStoreFactory interface. The transaction manager is responsible for:
  • Generating unique transaction identifiers.
  • Keeping a list of all open transactions within the raw store.
See Also:
  • Field Details

  • Method Details

    • getLockFactory

      LockFactory getLockFactory()
      Get the LockFactory to use with this store.
    • getXAResourceManager

      Object getXAResourceManager() throws StandardException
      Return the module providing XAresource interface to the transaction table.
      Throws:
      StandardException - Standard Derby exception policy.
    • startTransaction

      RawTransaction startTransaction(RawStoreFactory rsf, ContextManager contextMgr, String transName) throws StandardException
      Start a new transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startTransaction
      Parameters:
      contextMgr - is the context manager to use. It must be the current context manager.
      transName - is the transaction name. It will be displayed in the transactiontable VTI.
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • startNestedReadOnlyUserTransaction

      RawTransaction startNestedReadOnlyUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, String transName) throws StandardException
      Start a new read only transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTransaction
      Parameters:
      rsf - the RawStoreFactory
      parentTransaction - the parent transaction
      compatibilitySpace - compatibility space to use for locks.
      contextMgr - is the context manager to use. It must be the current context manager.
      transName - is the transaction name. It will be displayed in the transactiontable VTI.
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • startNestedUpdateUserTransaction

      RawTransaction startNestedUpdateUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, ContextManager contextMgr, String transName, boolean flush_log_on_xact_end) throws StandardException
      Start a new update transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTransaction
      Parameters:
      rsf - the RawStoreFactory
      parentTransaction - the parent transaction
      contextMgr - is the context manager to use. It must be the current context manager.
      transName - is the transaction name. It will be displayed in the transactiontable VTI.
      flush_log_on_xact_end - By default should the transaction commit and abort be synced to the log. Normal usage should pick true, unless there is specific performance need and usage works correctly if a commit can be lost on system crash.
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • startGlobalTransaction

      RawTransaction startGlobalTransaction(RawStoreFactory rsf, ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id) throws StandardException
      Start a new transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startTransaction
      Parameters:
      contextMgr - is the context manager to use. It must be the current context manager.
      format_id - the format id part of the Xid - ie. Xid.getFormatId().
      global_id - the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().
      branch_id - The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • findUserTransaction

      RawTransaction findUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, String transName) throws StandardException
      Find a user transaction within the given raw store and the given contextMgr. If no user transaction exist, then start one with name transName. This method will push a transaction context as described in RawStoreFactory.startTransaction
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • startNestedTopTransaction

      RawTransaction startNestedTopTransaction(RawStoreFactory rsf, ContextManager contextMgr) throws StandardException
      Start a new nested top transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTopTransaction
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • startInternalTransaction

      RawTransaction startInternalTransaction(RawStoreFactory rsf, ContextManager contextMgr) throws StandardException
      Start a new internal transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startInternalTransaction
      Throws:
      StandardException - Standard Derby error policy.
      See Also:
    • findTransaction

      boolean findTransaction(TransactionId id, RawTransaction tran)
      Find a transaction using a transactionId and make the passed in transaction assume the identity and properties of that transaction. Used in recovery only.
    • resetTranId

      void resetTranId() throws StandardException
      Reset any resettable transaction Id
      Throws:
      StandardException - Standard Derby error policy.
    • firstUpdateInstant

      LogInstant firstUpdateInstant()
      The first log instant that belongs to a transaction that is still active in the raw store. This is the first log record of the longest running transaction at this moment.
    • handlePreparedXacts

      void handlePreparedXacts(RawStoreFactory rsf) throws StandardException
      Run through all prepared transactions known to this factory and restore their state such that they remain after recovery, and can be found and handled by a XA transaction manager. This includes creating a context manager for each, pushing a xact context, and reclaiming update locks on all data changed by the transaction. Used only in recovery.
      Throws:
      StandardException - Derby Standard Error policy
    • rollbackAllTransactions

      void rollbackAllTransactions(RawTransaction recoveryTransaction, RawStoreFactory rsf) throws StandardException
      Rollback and close all transactions known to this factory using a passed in transaction. Used only in recovery.
      Parameters:
      recoveryTransaction - the transaction used to rollback
      Throws:
      StandardException - Derby Standard Error policy
    • submitPostCommitWork

      boolean submitPostCommitWork(Serviceable work)
      Submit a post commit work to the post commit daemon. The work is always added to the deamon, regardless of the state it returns.
      Returns:
      true if the daemon indicates it is being overloaded, false it's happy. must be MT-safe
    • setRawStoreFactory

      void setRawStoreFactory(RawStoreFactory rsf) throws StandardException
      make Transaction factory aware of which raw store factory it belongs to
      Throws:
      StandardException
    • noActiveUpdateTransaction

      boolean noActiveUpdateTransaction()
      Returns true if the transaction factory has no active updating transaction
    • hasPreparedXact

      boolean hasPreparedXact()
      Check if there are any prepared transanctions.

      MT - unsafe, called during boot, which is single threaded.

      Returns:
      true if prepared transactions exist, false otherwise.
    • createFinished

      void createFinished() throws StandardException
      Database creation finished
      Throws:
      StandardException - Standard Derby exception policy.
    • getTransactionTable

      Formatable getTransactionTable()
      Return the transaction table so it can get logged with the checkpoint log record.
    • useTransactionTable

      void useTransactionTable(Formatable transactionTable) throws StandardException
      Use this transaction table, which is gotten from a checkpoint operation. Use ONLY during recovery.
      Throws:
      StandardException - Standard Derby exception policy.
    • getTransactionInfo

      TransactionInfo[] getTransactionInfo()
      See Also:
    • blockBackupBlockingOperations

      boolean blockBackupBlockingOperations(boolean wait) throws StandardException
      Checks if there any backup blocking operations are in progress and prevents new ones from starting until the backup is finished.
      Parameters:
      wait - if true, waits for the current backup blocking operations in progress to finish.
      Returns:
      true if there are no backup blocking operations in progress. false otherwise.
      Throws:
      StandardException - if interrupted or a runtime exception occurs.
    • unblockBackupBlockingOperations

      void unblockBackupBlockingOperations()
      Backup completed. Allow backup blocking operations.