Top Description Fields Methods
org.apache.derby.iapi.store.raw.xact

public Interface TransactionFactory

extends Corruptable
Known Direct Implementers
org.apache.derby.impl.store.raw.xact.XactFactory
Imports
org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.daemon.Serviceable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.locks.CompatibilitySpace, .LockFactory, org.apache.derby.iapi.store.access.TransactionInfo, org.apache.derby.iapi.store.raw.RawStoreFactory, .Transaction, .Corruptable, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.shared.common.error.StandardException

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:
See Also
RawStoreFactory, Transaction

Field Summary

Modifier and TypeField and Description
public static final String

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if there are no backup blocking operations in progress. false otherwise.
blockBackupBlockingOperations
(boolean
if true, waits for the current backup blocking operations in progress to finish.
wait
)

Checks if there any backup blocking operations are in progress and prevents new ones from starting until the backup is finished.

public void
createFinished()

Database creation finished

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

public RawTransaction
findUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, String transName)

Find a user transaction within the given raw store and the given contextMgr.

public LogInstant
firstUpdateInstant()

The first log instant that belongs to a transaction that is still active in the raw store.

public LockFactory
getLockFactory()

Get the LockFactory to use with this store.

public TransactionInfo[]
public Formatable
getTransactionTable()

Return the transaction table so it can get logged with the checkpoint log record.

public Object
getXAResourceManager()

Return the module providing XAresource interface to the transaction table.

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

public boolean

Returns:

true if prepared transactions exist, false otherwise.
hasPreparedXact
()

Check if there are any prepared transanctions.

public boolean
noActiveUpdateTransaction()

Returns true if the transaction factory has no active updating transaction

public void
resetTranId()

Reset any resettable transaction Id

public void
rollbackAllTransactions(RawTransaction
the transaction used to rollback
recoveryTransaction
,
RawStoreFactory rsf)

Rollback and close all transactions known to this factory using a passed in transaction.

public void
setRawStoreFactory(RawStoreFactory rsf)

make Transaction factory aware of which raw store factory it belongs to

public RawTransaction
startGlobalTransaction(RawStoreFactory rsf, ContextManager
is the context manager to use. It must be the current context manager.
contextMgr
,
int
the format id part of the Xid - ie. Xid.getFormatId().
format_id
,
byte[]
the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().
global_id
,
byte[]
The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()
branch_id
)

Start a new transaction within the given raw store.

public RawTransaction
startInternalTransaction(RawStoreFactory rsf, ContextManager contextMgr)

Start a new internal transaction within the given raw store.

public RawTransaction
startNestedReadOnlyUserTransaction(RawStoreFactory
the RawStoreFactory
rsf
,
RawTransaction
the parent transaction
parentTransaction
,
CompatibilitySpace
compatibility space to use for locks.
compatibilitySpace
,
ContextManager
is the context manager to use. It must be the current context manager.
contextMgr
,
String
is the transaction name. It will be displayed in the transactiontable VTI.
transName
)

Start a new read only transaction within the given raw store.

public RawTransaction
startNestedTopTransaction(RawStoreFactory rsf, ContextManager contextMgr)

Start a new nested top transaction within the given raw store.

public RawTransaction
startNestedUpdateUserTransaction(RawStoreFactory
the RawStoreFactory
rsf
,
RawTransaction
the parent transaction
parentTransaction
,
ContextManager
is the context manager to use. It must be the current context manager.
contextMgr
,
String
is the transaction name. It will be displayed in the transactiontable VTI.
transName
,
boolean
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.
flush_log_on_xact_end
)

Start a new update transaction within the given raw store.

public RawTransaction
startTransaction(RawStoreFactory rsf, ContextManager
is the context manager to use. It must be the current context manager.
contextMgr
,
String
is the transaction name. It will be displayed in the transactiontable VTI.
transName
)

Start a new transaction within the given raw store.

public boolean

Returns:

true if the daemon indicates it is being overloaded, false it's happy. must be MT-safe
submitPostCommitWork
(Serviceable work)

Submit a post commit work to the post commit daemon.

public void
public void
useTransactionTable(Formatable transactionTable)

Use this transaction table, which is gotten from a checkpoint operation.

Inherited from org.apache.derby.iapi.store.raw.Corruptable:
markCorrupt

Field Detail

MODULEback to summary
public static final String MODULE

Method Detail

blockBackupBlockingOperationsback to summary
public 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:boolean

if true, waits for the current backup blocking operations in progress to finish.

Returns:boolean

true if there are no backup blocking operations in progress. false otherwise.

Exceptions
StandardException:
if interrupted or a runtime exception occurs.
createFinishedback to summary
public void createFinished() throws StandardException

Database creation finished

Exceptions
StandardException:
Standard Derby exception policy.
findTransactionback to summary
public 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.

findUserTransactionback to summary
public 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

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#findUserTransaction, RawStoreFactory#startTransaction
firstUpdateInstantback to summary
public 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.

getLockFactoryback to summary
public LockFactory getLockFactory()

Get the LockFactory to use with this store.

getTransactionInfoback to summary
public TransactionInfo[] getTransactionInfo()
See Also
org.apache.derby.iapi.store.access.AccessFactory#getTransactionInfo
getTransactionTableback to summary
public Formatable getTransactionTable()

Return the transaction table so it can get logged with the checkpoint log record.

getXAResourceManagerback to summary
public Object getXAResourceManager() throws StandardException

Return the module providing XAresource interface to the transaction table.

Exceptions
StandardException:
Standard Derby exception policy.
handlePreparedXactsback to summary
public 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.

Exceptions
StandardException:
Derby Standard Error policy
hasPreparedXactback to summary
public boolean hasPreparedXact()

Check if there are any prepared transanctions.

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

Returns:boolean

true if prepared transactions exist, false otherwise.

noActiveUpdateTransactionback to summary
public boolean noActiveUpdateTransaction()

Returns true if the transaction factory has no active updating transaction

resetTranIdback to summary
public void resetTranId() throws StandardException

Reset any resettable transaction Id

Exceptions
StandardException:
Standard Derby error policy.
rollbackAllTransactionsback to summary
public 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:RawTransaction

the transaction used to rollback

Exceptions
StandardException:
Derby Standard Error policy
setRawStoreFactoryback to summary
public void setRawStoreFactory(RawStoreFactory rsf) throws StandardException

make Transaction factory aware of which raw store factory it belongs to

startGlobalTransactionback to summary
public 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:ContextManager

is the context manager to use. It must be the current context manager.

format_id:int

the format id part of the Xid - ie. Xid.getFormatId().

global_id:byte[]

the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().

branch_id:byte[]

The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startGlobalTransaction
startInternalTransactionback to summary
public 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

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startTransaction
startNestedReadOnlyUserTransactionback to summary
public 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:RawStoreFactory

the RawStoreFactory

parentTransaction:RawTransaction

the parent transaction

compatibilitySpace:CompatibilitySpace

compatibility space to use for locks.

contextMgr:ContextManager

is the context manager to use. It must be the current context manager.

transName:String

is the transaction name. It will be displayed in the transactiontable VTI.

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startNestedReadOnlyUserTransaction
startNestedTopTransactionback to summary
public 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

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startTransaction(ContextManager, String)
startNestedUpdateUserTransactionback to summary
public 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:RawStoreFactory

the RawStoreFactory

parentTransaction:RawTransaction

the parent transaction

contextMgr:ContextManager

is the context manager to use. It must be the current context manager.

transName:String

is the transaction name. It will be displayed in the transactiontable VTI.

flush_log_on_xact_end:boolean

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.

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startNestedUpdateUserTransaction
startTransactionback to summary
public 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:ContextManager

is the context manager to use. It must be the current context manager.

transName:String

is the transaction name. It will be displayed in the transactiontable VTI.

Exceptions
StandardException:
Standard Derby error policy.
See Also
RawStoreFactory#startTransaction
submitPostCommitWorkback to summary
public 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:boolean

true if the daemon indicates it is being overloaded, false it's happy. must be MT-safe

unblockBackupBlockingOperationsback to summary
public void unblockBackupBlockingOperations()

Backup completed. Allow backup blocking operations.

useTransactionTableback to summary
public void useTransactionTable(Formatable transactionTable) throws StandardException

Use this transaction table, which is gotten from a checkpoint operation. Use ONLY during recovery.

Exceptions
StandardException:
Standard Derby exception policy.