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:
RawStoreFactory,Transaction
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMODULE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanblockBackupBlockingOperations(boolean wait)Checks if there any backup blocking operations are in progress and prevents new ones from starting until the backup is finished.voidcreateFinished()Database creation finishedbooleanfindTransaction(TransactionId id, RawTransaction tran)Find a transaction using a transactionId and make the passed in transaction assume the identity and properties of that transaction.RawTransactionfindUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.String transName)Find a user transaction within the given raw store and the given contextMgr.LogInstantfirstUpdateInstant()The first log instant that belongs to a transaction that is still active in the raw store.LockFactorygetLockFactory()Get the LockFactory to use with this store.TransactionInfo[]getTransactionInfo()FormatablegetTransactionTable()Return the transaction table so it can get logged with the checkpoint log record.java.lang.ObjectgetXAResourceManager()Return the module providing XAresource interface to the transaction table.voidhandlePreparedXacts(RawStoreFactory rsf)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.booleanhasPreparedXact()Check if there are any prepared transanctions.booleannoActiveUpdateTransaction()Returns true if the transaction factory has no active updating transactionvoidresetTranId()Reset any resettable transaction IdvoidrollbackAllTransactions(RawTransaction recoveryTransaction, RawStoreFactory rsf)Rollback and close all transactions known to this factory using a passed in transaction.voidsetRawStoreFactory(RawStoreFactory rsf)make Transaction factory aware of which raw store factory it belongs toRawTransactionstartGlobalTransaction(RawStoreFactory rsf, ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id)Start a new transaction within the given raw store.RawTransactionstartInternalTransaction(RawStoreFactory rsf, ContextManager contextMgr)Start a new internal transaction within the given raw store.RawTransactionstartNestedReadOnlyUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName)Start a new read only transaction within the given raw store.RawTransactionstartNestedTopTransaction(RawStoreFactory rsf, ContextManager contextMgr)Start a new nested top transaction within the given raw store.RawTransactionstartNestedUpdateUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, ContextManager contextMgr, java.lang.String transName, boolean flush_log_on_xact_end)Start a new update transaction within the given raw store.RawTransactionstartTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.String transName)Start a new transaction within the given raw store.booleansubmitPostCommitWork(Serviceable work)Submit a post commit work to the post commit daemon.voidunblockBackupBlockingOperations()Backup completed.voiduseTransactionTable(Formatable transactionTable)Use this transaction table, which is gotten from a checkpoint operation.-
Methods inherited from interface org.apache.derby.iapi.store.raw.Corruptable
markCorrupt
-
-
-
-
Field Detail
-
MODULE
static final java.lang.String MODULE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLockFactory
LockFactory getLockFactory()
Get the LockFactory to use with this store.
-
getXAResourceManager
java.lang.Object getXAResourceManager() throws StandardExceptionReturn the module providing XAresource interface to the transaction table.- Throws:
StandardException- Standard Derby exception policy.
-
startTransaction
RawTransaction startTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.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:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
-
startNestedReadOnlyUserTransaction
RawTransaction startNestedReadOnlyUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.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 RawStoreFactoryparentTransaction- the parent transactioncompatibilitySpace- 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:
RawStoreFactory.startNestedReadOnlyUserTransaction(org.apache.derby.iapi.store.raw.Transaction, org.apache.derby.iapi.services.locks.CompatibilitySpace, org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
-
startNestedUpdateUserTransaction
RawTransaction startNestedUpdateUserTransaction(RawStoreFactory rsf, RawTransaction parentTransaction, ContextManager contextMgr, java.lang.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 RawStoreFactoryparentTransaction- the parent transactioncontextMgr- 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:
RawStoreFactory.startNestedUpdateUserTransaction(org.apache.derby.iapi.store.raw.Transaction, org.apache.derby.iapi.services.context.ContextManager, java.lang.String, boolean)
-
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:
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()contextMgr- is the context manager to use. It must be the current context manager.- Throws:
StandardException- Standard Derby error policy.- See Also:
RawStoreFactory.startGlobalTransaction(org.apache.derby.iapi.services.context.ContextManager, int, byte[], byte[])
-
findUserTransaction
RawTransaction findUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.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
-
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:
RawStoreFactory.startTransaction(ContextManager, String)
-
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:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
-
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 StandardExceptionReset 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 StandardExceptionDatabase 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:
AccessFactory.getTransactionInfo()
-
blockBackupBlockingOperations
boolean blockBackupBlockingOperations(boolean wait) throws StandardExceptionChecks 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.
-
-