public class Xact extends RawTransaction implements Limit, LockOwner
Transaction
Modifier and Type | Field and Description |
---|---|
protected static int |
ACTIVE |
private boolean |
backupBlocked |
protected static int |
CLOSED |
private static int |
COMMIT_NO_SYNC |
private static int |
COMMIT_PREPARE |
private static int |
COMMIT_SYNC
private static -
make sure these bits don't overwrite bits in Transaction.commit commitflag
|
private CompatibilitySpace |
compatibilitySpace |
protected DataFactory |
dataFactory |
protected DataValueFactory |
dataValueFactory |
private LockingPolicy |
defaultLocking |
private boolean |
dontWaitForLocks
Tells if lock requests should time out immediately if they cannot be
granted without waiting.
|
static int |
END_ABORTED |
static int |
END_COMMITTED |
static int |
END_PREPARED |
private boolean |
flush_log_on_xact_end |
protected static int |
IDLE |
private java.lang.Integer |
inComplete |
private boolean |
inPostCommitProcessing |
static int |
INTERNAL_TRANSACTION |
private boolean |
justCreated |
(package private) DynamicByteArrayOutputStream |
logBuffer |
protected LogFactory |
logFactory |
protected Logger |
logger |
private LogInstant |
logLast |
private LogInstant |
logStart |
private GlobalTransactionId |
myGlobalId |
private TransactionId |
myId |
private boolean |
needSync |
static int |
NESTED_TOP_TRANSACTION |
private TransactionId |
parentTransactionId |
protected java.util.List<Serviceable> |
postAbortWorks |
protected java.util.List<Serviceable> |
postCommitWorks |
private boolean |
postCompleteMode |
protected java.util.List<Serviceable> |
postTerminationWorks |
protected static int |
PREPARED |
private boolean |
readOnly |
static int |
RECOVERY_ROLLBACK_FIRST |
private boolean |
recoveryTransaction |
private boolean |
sanityCheck_xaclosed |
private int |
savedEndStatus |
private java.util.Stack<SavePoint> |
savePoints |
private boolean |
seenUpdates |
protected int |
state |
private java.lang.String |
transName |
protected static int |
UPDATE |
protected XactFactory |
xactFactory |
protected XactContext |
xc |
ABORT, COMMIT, LOCK_ESCALATE, observerException, SAVEPOINT_ROLLBACK
KEEP_LOCKS, RELEASE_LOCKS, XA_OK, XA_RDONLY
Modifier | Constructor and Description |
---|---|
protected |
Xact(XactFactory xactFactory,
Xact parentTransaction,
LogFactory logFactory,
DataFactory dataFactory,
DataValueFactory dataValueFactory,
boolean readOnly,
CompatibilitySpace compatibilitySpace,
boolean flush_log_on_xact_end) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort all changes made by this transaction since the last commit, abort
or the point the transaction was started, whichever is the most recent.
|
long |
addAndLoadStreamContainer(long segmentId,
java.util.Properties tableProperties,
RowSource rowSource)
Add a new stream container to the segment and load the stream container.
|
long |
addContainer(long segmentId,
long containerid,
int mode,
java.util.Properties tableProperties,
int temporaryFlag)
Add a new container to the segment.
|
void |
addPostAbortWork(Serviceable work)
Add to the list of post abort work that may be processed after this
transaction aborts.
|
void |
addPostCommitWork(Serviceable work)
Add to the list of post commit work that may be processed after this
transaction commits.
|
void |
addPostTerminationWork(Serviceable work)
Add to the list of post termination work that may be processed after this
transaction commits or aborts.
|
void |
addUpdateTransaction(int transactionStatus)
Add this to the xactFactory list of update transaction.
|
boolean |
anyoneBlocked()
Return true if any transaction is currently blocked, even if not by
this transaction.
|
protected void |
assumeGlobalXactIdentity(TransactionTableEntry ent)
Assume complete identity of the given Transaction Table Entry.
|
protected void |
assumeIdentity(TransactionTableEntry ent)
Transform this identity to the one stored in transaction table entry.
|
boolean |
blockBackup(boolean wait)
Make the transaction block the online backup.
|
private void |
checkObserverException() |
void |
checkpointInRollForwardRecovery(LogInstant cinstant,
long redoLWM,
long undoLWM)
Perform a checkpoint during rollforward recovery.
|
void |
close()
Close this transaction, the transaction must be idle.
|
LogInstant |
commit()
Commit this transaction.
|
private LogInstant |
commit(int commitflag) |
LogInstant |
commitNoSync(int commitflag)
"Commit" this transaction without sync'ing the log.
|
private void |
completeCommit(int commitflag)
Do work to complete a commit which is not just a prepare.
|
void |
createXATransactionFromLocalTransaction(int format_id,
byte[] global_id,
byte[] branch_id)
Convert a local transaction to a global transaction.
|
LockingPolicy |
defaultLockingPolicy() |
void |
destroy()
If this transaction is not idle, abort it.
|
protected void |
doComplete(java.lang.Integer commitOrAbort) |
protected boolean |
doPostCommitWorkInTran()
If this is a user transaction (not an internal or nested top
transaction), and this is not already taking care of post
commit work, and not an XA transaction, then take care of hi prioirty
work right now using this thread and this context manager.
|
void |
dropContainer(ContainerKey containerId)
Drop a container.
|
void |
dropStreamContainer(long segmentId,
long containerId)
Drop a stream container.
|
java.lang.String |
getActiveStateTxIdString()
Get string id of the transaction that would be when the Transaction
is IN active state.
|
CompatibilitySpace |
getCompatibilitySpace()
Get the compatibility space of the transaction.
|
java.lang.String |
getContextId()
Get my transaction context Id
|
ContextManager |
getContextManager()
Return the context manager this transaction is associated with.
|
DataFactory |
getDataFactory()
Get the data factory to be used during this transaction.
|
DataValueFactory |
getDataValueFactory()
Get DataValueFactory.
|
LockingPolicy |
getDefaultLockingPolicy()
Get the current default locking policy for all operations within this
transaction.
|
FileResource |
getFileHandler()
Get an object to handle non-transactional files.
|
LogInstant |
getFirstLogInstant()
Get the log instant for the first log record written by this transaction.
|
GlobalTransactionId |
getGlobalId()
get the Global (external to raw store) transaction id that is unique
across all raw stores
|
TransactionId |
getId()
get the short (internal to raw store) transaction id that is unique
only for this raw store
|
protected TransactionId |
getIdNoCheck()
Get the transaction id without sanity check, this should only be called
by a cloned TransactionTableEntry
|
LogInstant |
getLastLogInstant()
Get the log instant for the last log record written by this transaction.
|
LockFactory |
getLockFactory()
Get the lock factory to be used during this transaction.
|
DynamicByteArrayOutputStream |
getLogBuffer()
Get the log buffer to be used during this transaction.
|
LogFactory |
getLogFactory()
JIRA-606.
|
private void |
getLogger()
Get the Logger object used to write log records to the transaction log.
|
private int |
getSavePointPosition(java.lang.String name,
java.lang.Object kindOfSavepoint,
boolean forRollbackOrRelease)
Does a save point exist in the stack with the given name.
|
(package private) java.lang.String |
getState() |
java.lang.String |
getTransName() |
boolean |
handlesPostTerminationWork()
Can this transaction handles post termination work
|
boolean |
inAbort()
Is the transaction in the middle of an abort.
|
boolean |
inRollForwardRecovery()
Is the transaction in rollforward recovery
|
boolean |
isActive()
see if this transaction has ever done anything.
|
boolean |
isBlockingBackup()
Check if the transaction is blocking the backup ?
|
boolean |
isIdle()
See if this transaction is in the idle state, called by other thread to
test the state of this transaction.
|
boolean |
isNestedOwner()
Return true if this is a nested owner, e.g., a nested user transaction.
|
boolean |
isPrepared()
see if this transaction is in PREPARED state.
|
boolean |
isPristine()
see if this transaction is in a pristine state.
|
private boolean |
isUserTransaction()
see if this transaction is a user transaction.
|
void |
logAndDo(Loggable operation)
Log the operation and do it.
|
void |
logAndUndo(Compensation compensation,
LogInstant undoInstant,
LimitObjectInput in)
Log and apply a compensation operation.
|
boolean |
nestsUnder(LockOwner other)
Return true if this owner nests under another owner.
|
LockingPolicy |
newLockingPolicy(int mode,
int isolation,
boolean stricterOk)
Obtain a locking policy for use in openContainer().
|
boolean |
noWait()
Tells whether lock requests should time out immediately if they can't
be granted without waiting.
|
ContainerHandle |
openContainer(ContainerKey containerId,
int mode)
Open a container, with the transaction's default locking policy.
|
ContainerHandle |
openContainer(ContainerKey containerId,
LockingPolicy locking,
int mode)
Open a container, with the defined locking policy, otherwise
as openContainer(int containerId, boolean forUpdate).
|
RawContainerHandle |
openDroppedContainer(ContainerKey containerId,
LockingPolicy locking)
Open a container that may already have been dropped.
|
StreamContainerHandle |
openStreamContainer(long segmentId,
long containerId,
boolean hold)
Open a stream container.
|
protected boolean |
popSavePoints(int position,
boolean release)
Pop all savepoints upto the one with the given name and rollback
all changes made since this savepoint was pushed.
|
protected void |
postComplete(int commitflag,
java.lang.Integer commitOrAbort) |
private void |
postTermination() |
protected void |
preComplete(java.lang.Integer commitOrAbort) |
private LogInstant |
prepareCommit(int commitflag)
Do work of commit that is common to xa_prepare and commit.
|
void |
prepareTransaction()
Remove this from the xactFactory list of update transaction.
|
void |
reached(CompatibilitySpace compatibilitySpace,
java.lang.Object group,
int limit,
java.util.Enumeration lockList,
int lockCount)
Called by the lock factory when a limit has been reached.
|
void |
recoveryTransaction()
Make this transaction aware that it is being used by recovery
|
void |
reCreateContainerForRedoRecovery(long segmentId,
long containerId,
ByteArray containerInfo)
Recreate a container during redo recovery.
|
private void |
releaseAllLocks() |
int |
releaseSavePoint(java.lang.String name,
java.lang.Object kindOfSavepoint)
Release the save point of the given name.
|
void |
removeUpdateTransaction()
Remove this from the xactFactory list of update transaction.
|
void |
reprepare()
During recovery re-prepare a transaction.
|
(package private) void |
resetDefaultLocking() |
int |
rollbackToSavePoint(java.lang.String name,
java.lang.Object kindOfSavepoint)
Rollback all changes made since the named savepoint was set.
|
protected void |
setActiveState() |
void |
setDefaultLockingPolicy(LockingPolicy policy)
Set the default locking policy for all operations within this
transaction.
|
void |
setFirstLogInstant(LogInstant instant)
Set the log instant for the first log record written by this transaction.
|
protected void |
setIdleState() |
void |
setLastLogInstant(LogInstant instant)
Set the log instant for the last log record written by this transaction.
|
void |
setNoLockWait(boolean noWait)
Tell this transaction whether it should time out immediately if a lock
cannot be granted without waiting.
|
(package private) void |
setPostComplete()
Set the transaction to issue pre complete work at postComplete
time, instead of preComplete time.
|
protected void |
setPrepareState()
Move the state of the transaction from UPDATE to PREPARE.
|
int |
setSavePoint(java.lang.String name,
java.lang.Object kindOfSavepoint)
Set a save point in the current transaction.
|
(package private) void |
setTransactionId(GlobalTransactionId extid,
TransactionId localid)
Set my transaction identifier.
|
void |
setTransactionId(Loggable beginXact,
TransactionId localId)
Set the transactionId (Global and internal) of this transaction using a
log record that contains the Global id
|
void |
setTransName(java.lang.String name) |
void |
setup(PersistentSet set)
The default value for LOCKS_ESCALATION_THRESHOLD
|
private void |
setUpdateState()
Move the transaction into the update state.
|
RawTransaction |
startNestedTopTransaction()
Start a nested top transaction.
|
protected int |
statusForBeginXactLog()
put this into the beginXact log record to help recovery
if we needs to rolled back first, put that in
|
protected int |
statusForEndXactLog()
put this into the endXact log record to help recovery,
nothing to add
|
private void |
throwExceptionIfSQLSavepointNotAllowed(java.lang.Object kindOfSavepoint) |
java.lang.String |
toInternalDetailString() |
java.lang.String |
toString()
Return the xid as a string.
|
private void |
transferPostCommitorAbortWork(java.util.List<Serviceable> work_list) |
private void |
unblockBackup()
Unblock the backup, if it was blocked by some operation in
this transaction.
|
void |
xa_commit(boolean onePhase)
This method is called to commit the current XA global transaction.
|
int |
xa_prepare()
This method is called to ask the resource manager to prepare for
a transaction commit of the transaction specified in xid.
|
void |
xa_rollback()
rollback the current global transaction.
|
checkLogicalOperationOk, notifyObservers, recoveryRollbackFirst, setObserverException
addObserver, countObservers, deleteObserver, notifyObservers, setChanged
protected static final int CLOSED
protected static final int IDLE
protected static final int ACTIVE
protected static final int UPDATE
protected static final int PREPARED
public static final int END_ABORTED
public static final int END_PREPARED
public static final int END_COMMITTED
public static final int RECOVERY_ROLLBACK_FIRST
public static final int INTERNAL_TRANSACTION
public static final int NESTED_TOP_TRANSACTION
private static final int COMMIT_SYNC
private static final int COMMIT_NO_SYNC
private static final int COMMIT_PREPARE
private int savedEndStatus
private boolean needSync
private boolean justCreated
protected XactContext xc
protected final XactFactory xactFactory
protected final DataFactory dataFactory
protected final LogFactory logFactory
protected final DataValueFactory dataValueFactory
private final CompatibilitySpace compatibilitySpace
private LockingPolicy defaultLocking
private GlobalTransactionId myGlobalId
private volatile TransactionId myId
private volatile TransactionId parentTransactionId
protected Logger logger
protected volatile int state
private java.lang.Integer inComplete
private boolean seenUpdates
private boolean inPostCommitProcessing
private LogInstant logStart
private LogInstant logLast
private java.util.Stack<SavePoint> savePoints
protected java.util.List<Serviceable> postCommitWorks
protected java.util.List<Serviceable> postAbortWorks
protected java.util.List<Serviceable> postTerminationWorks
private boolean recoveryTransaction
DynamicByteArrayOutputStream logBuffer
private boolean postCompleteMode
private boolean sanityCheck_xaclosed
private java.lang.String transName
private boolean readOnly
private boolean flush_log_on_xact_end
private boolean backupBlocked
private boolean dontWaitForLocks
protected Xact(XactFactory xactFactory, Xact parentTransaction, LogFactory logFactory, DataFactory dataFactory, DataValueFactory dataValueFactory, boolean readOnly, CompatibilitySpace compatibilitySpace, boolean flush_log_on_xact_end)
public final LockFactory getLockFactory()
RawTransaction
getLockFactory
in class RawTransaction
public final DataFactory getDataFactory()
RawTransaction
getDataFactory
in class RawTransaction
public final LogFactory getLogFactory()
getLogFactory
in class RawTransaction
public boolean anyoneBlocked()
anyoneBlocked
in interface Transaction
public DynamicByteArrayOutputStream getLogBuffer()
RawTransaction
getLogBuffer
in class RawTransaction
public void logAndUndo(Compensation compensation, LogInstant undoInstant, LimitObjectInput in) throws StandardException
logAndUndo
in class RawTransaction
compensation
- the Compensation OperationundoInstant
- the LogInstant of the Loggable Operation this
compensation operation is going to roll backin
- optional data for the rollback operationStandardException
- Standard Derby exception policyTransaction.logAndDo(org.apache.derby.iapi.store.raw.Loggable)
public void addUpdateTransaction(int transactionStatus)
addUpdateTransaction
in class RawTransaction
public void removeUpdateTransaction()
removeUpdateTransaction
in class RawTransaction
public void prepareTransaction()
prepareTransaction
in class RawTransaction
public void setFirstLogInstant(LogInstant instant)
setFirstLogInstant
in class RawTransaction
public LogInstant getFirstLogInstant()
getFirstLogInstant
in class RawTransaction
public void setLastLogInstant(LogInstant instant)
setLastLogInstant
in class RawTransaction
public LogInstant getLastLogInstant()
getLastLogInstant
in class RawTransaction
void setTransactionId(GlobalTransactionId extid, TransactionId localid)
public void setTransactionId(Loggable beginXact, TransactionId localId)
RawTransaction
setTransactionId
in class RawTransaction
public void setup(PersistentSet set) throws StandardException
setup
in interface Transaction
StandardException
- Standard Derby exception policypublic final GlobalTransactionId getGlobalId()
getGlobalId
in interface Transaction
getGlobalId
in class RawTransaction
public final ContextManager getContextManager()
Transaction
getContextManager
in interface Transaction
public final CompatibilitySpace getCompatibilitySpace()
Returns an object that can be used with the lock manager to provide the compatibility space of a transaction. 2 transactions with the same compatibility space will not conflict in locks. The usual case is that each transaction has it's own unique compatibility space.
getCompatibilitySpace
in interface Transaction
public boolean noWait()
public void setNoLockWait(boolean noWait)
This only works if this transaction is the owner of the compatibility space used in the request. If this transaction has inherited the compatibility space from its parent, the call to this method has no effect (except in debug builds, where an error will be raised).
setNoLockWait
in interface Transaction
noWait
- if true
never wait for a lock in this transaction,
but time out immediatelyLockOwner.noWait()
public final TransactionId getId()
getId
in class RawTransaction
protected final TransactionId getIdNoCheck()
public final java.lang.String getContextId()
public LockingPolicy getDefaultLockingPolicy()
newLockingPolicy( LockingPolicy.MODE_RECORD, TransactionController.ISOLATION_SERIALIZABLE, true);This default can be changed by subsequent calls to setDefaultLockingPolicy(LockingPolicy policy).
getDefaultLockingPolicy
in interface Transaction
Transaction.getDefaultLockingPolicy()
public final LockingPolicy newLockingPolicy(int mode, int isolation, boolean stricterOk)
Transaction
newLockingPolicy
in interface Transaction
mode
- A constant of the form LockingPolicy.MODE_*isolation
- A constant of the form LockingPolicy.ISOLATION_*stricterOk
- True if a stricter level of locking is acceptable,
false if an exact match is required.Transaction.newLockingPolicy(int, int, boolean)
public final void setDefaultLockingPolicy(LockingPolicy policy)
Transaction
newLockingPolicy( LockingPolicy.MODE_RECORD, LockingPolicy.ISOLATION_SERIALIZABLE, true);
setDefaultLockingPolicy
in interface Transaction
policy
- The lock policy to use, if null then then a no locking
policy will be installed as the default.Transaction.setDefaultLockingPolicy(org.apache.derby.iapi.store.raw.LockingPolicy)
public LogInstant commit() throws StandardException
Transaction
commit
in interface Transaction
StandardException
- Standard Derby exception policypublic LogInstant commitNoSync(int commitflag) throws StandardException
Transaction
commitNoSync
in interface Transaction
StandardException
- Standard Derby exception policyprivate LogInstant prepareCommit(int commitflag) throws StandardException
Do all the work necessary as part of a commit up to and including writing the commit log record. This routine is used by both prepare and commit. The work post commit is done by completeCommit().
commitflag
- various flavors of commit.StandardException
- Standard exception policy.Transaction.commit()
private void completeCommit(int commitflag) throws StandardException
Releases locks, does post commit work, and moves the state of the transaction to IDLE.
commitflag
- various flavors of commit.StandardException
- Standard exception policy.private LogInstant commit(int commitflag) throws StandardException
StandardException
- Standard Derby exception policyTransaction.commit()
public void abort() throws StandardException
Transaction
abort
in interface Transaction
StandardException
- Standard Derby exception policyTransaction.abort()
public void reprepare() throws StandardException
After redo() and undo(), this routine is called on all outstanding in-doubt (prepared) transactions. This routine re-acquires all logical write locks for operations in the xact, and then modifies the transaction table entry to make the transaction look as if it had just been prepared following startup after recovery.
This routine is only called during Recovery.
reprepare
in class RawTransaction
StandardException
- Standard exception policy.public void destroy() throws StandardException
destroy
in interface Transaction
StandardException
- Standard Derby error policy
Thrown if the transaction is not idle.RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
public void close() throws StandardException
Transaction
close
in interface Transaction
StandardException
- Thrown if the transaction is not idle, the
transaction remains open.Transaction.close()
public void logAndDo(Loggable operation) throws StandardException
logAndDo
in interface Transaction
operation
- the operation that is to be appliedStandardException
- Standard Derby exception policyTransaction.logAndDo(org.apache.derby.iapi.store.raw.Loggable)
public void addPostCommitWork(Serviceable work)
Transaction
addPostCommitWork
in interface Transaction
work
- the post commit work that is addedpublic void addPostAbortWork(Serviceable work)
addPostAbortWork
in interface Transaction
work
- the post commit work that is addedpublic void addPostTerminationWork(Serviceable work)
Transaction
addPostTerminationWork
in interface Transaction
work
- the post termination work that is addedpublic ContainerHandle openContainer(ContainerKey containerId, int mode) throws StandardException
Transaction
Note that if NOWAIT has been specified lock will be requested with no wait time, and if lock is not granted a SQLState.LOCK_TIMEOUT exception will be thrown.
The release() method of ContainerHandle will be called when this transaction is aborted or commited, it may be called explicitly to release the ContainerHandle before the end of the transaction.
openContainer
in interface Transaction
StandardException
- Standard Derby exception policyTransaction.openContainer(org.apache.derby.iapi.store.raw.ContainerKey, int)
public ContainerHandle openContainer(ContainerKey containerId, LockingPolicy locking, int mode) throws StandardException
Transaction
Calls locking.lockContainer(this, returnValue, forUpdate) to lock the container. Note that if NOWAIT has been specified lock will be requested with no wait time, and if lock is not granted a SQLState.LOCK_TIMEOUT exception will be thrown.
openContainer
in interface Transaction
locking
- The lock policy to use, if null then then a no locking
policy will be used.StandardException
- Standard Derby exception policyTransaction.openContainer(org.apache.derby.iapi.store.raw.ContainerKey, int)
public RawContainerHandle openDroppedContainer(ContainerKey containerId, LockingPolicy locking) throws StandardException
openDroppedContainer
in class RawTransaction
StandardException
- Standard Derby exception policyRawTransaction.openDroppedContainer(org.apache.derby.iapi.store.raw.ContainerKey, org.apache.derby.iapi.store.raw.LockingPolicy)
public long addContainer(long segmentId, long containerid, int mode, java.util.Properties tableProperties, int temporaryFlag) throws StandardException
Transaction
Synchronisation
The new container is exclusivly locked by this transaction until it commits.
addContainer
in interface Transaction
segmentId
- segment to create the container in.containerid
- If not equal to 0 then this container id will be
used to create the container, else if set to 0 then
the raw store will assign a number.mode
- mode description in @see ContainerHandle. This mode is
only effective for the duration of the addContainer call and not stored
persistently for the lifetime of the container.tableProperties
- Implementation-specific properties of the
conglomerate.StandardException
- Standard Derby exception policyTransaction.addContainer(long, long, int, java.util.Properties, int)
public long addAndLoadStreamContainer(long segmentId, java.util.Properties tableProperties, RowSource rowSource) throws StandardException
Transaction
Synchronisation
This call will mark the container as dropped and then obtain an CX lock on the container. Once a container has been marked as dropped it cannot be retrieved by any openContainer() call.
Once the exclusive lock has been obtained the container is removed and all its pages deallocated. The container will be fully removed at the commit time of the transaction.
addAndLoadStreamContainer
in interface Transaction
StandardException
- Standard Derby exception policyTransaction.addAndLoadStreamContainer(long, java.util.Properties, org.apache.derby.iapi.store.access.RowSource)
public StreamContainerHandle openStreamContainer(long segmentId, long containerId, boolean hold) throws StandardException
Transaction
openStreamContainer
in interface Transaction
StandardException
- Standard Derby exception policyTransaction.openStreamContainer(long, long, boolean)
public void dropStreamContainer(long segmentId, long containerId) throws StandardException
Transaction
Synchronisation
This call will remove the container.
dropStreamContainer
in interface Transaction
StandardException
- Standard Derby error policyTransaction.dropStreamContainer(long, long)
public void reCreateContainerForRedoRecovery(long segmentId, long containerId, ByteArray containerInfo) throws StandardException
reCreateContainerForRedoRecovery
in class RawTransaction
StandardException
- Standard Derby exception policyRawTransaction.reCreateContainerForRedoRecovery(long, long, org.apache.derby.iapi.util.ByteArray)
public void dropContainer(ContainerKey containerId) throws StandardException
Transaction
Synchronisation
This call will mark the container as dropped and then obtain an CX lock on the container. Once a container has been marked as dropped it cannot be retrieved by any openContainer() call.
Once the exclusive lock has been obtained the container is removed and all its pages deallocated. The container will be fully removed at the commit time of the transaction.
dropContainer
in interface Transaction
StandardException
- Standard Derby error policyTransaction.dropContainer(org.apache.derby.iapi.store.raw.ContainerKey)
public int setSavePoint(java.lang.String name, java.lang.Object kindOfSavepoint) throws StandardException
Transaction
setSavePoint
in interface Transaction
name
- The user provided name of the savepointkindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint)
Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
A String value for kindOfSavepoint would mean it is SQL savepoint
A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepointStandardException
- Standard Derby exception policyTransaction.setSavePoint(java.lang.String, java.lang.Object)
private void throwExceptionIfSQLSavepointNotAllowed(java.lang.Object kindOfSavepoint) throws StandardException
StandardException
- Standard Derby exception policyTransaction.setSavePoint(java.lang.String, java.lang.Object)
public int releaseSavePoint(java.lang.String name, java.lang.Object kindOfSavepoint) throws StandardException
Transaction
releaseSavePoint
in interface Transaction
name
- The user provided name of the savepoint, set by the user
in the setSavePoint() call.kindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint)
Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
A String value for kindOfSavepoint would mean it is SQL savepoint
A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepointStandardException
- Standard Derby exception policyTransaction.releaseSavePoint(java.lang.String, java.lang.Object)
public int rollbackToSavePoint(java.lang.String name, java.lang.Object kindOfSavepoint) throws StandardException
Transaction
rollbackToSavePoint
in interface Transaction
name
- The user provided name of the savepoint, set by the user
in the setSavePoint() call.kindOfSavepoint
- A NULL value means it is an internal savepoint (ie not a user defined savepoint)
Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepoint
A String value for kindOfSavepoint would mean it is SQL savepoint
A JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepointStandardException
- Standard Derby exception policyTransaction.rollbackToSavePoint(java.lang.String, java.lang.Object)
private void getLogger()
protected void assumeIdentity(TransactionTableEntry ent)
protected void assumeGlobalXactIdentity(TransactionTableEntry ent)
Used by the final phase of the recovery to create new real transactions to take on the identity of in-doubt prepared transactions found during redo. Need to assume the globalId.
ent
- The original entry we are assuming the identity of.private final void setUpdateState() throws StandardException
StandardException
- problem setting a transaction idprotected void setIdleState()
protected final void setActiveState() throws StandardException
StandardException
protected final void setPrepareState() throws StandardException
The state transition should only be from UPDATE to PREPARE. Read-only transactions (IDLE and ACTIVE) will never be prepared, they will be commited when the prepare is requested. Only Update transactions will be allowed to go to prepared state.
StandardException
- Standard exception policy.public final LockingPolicy defaultLockingPolicy()
private final void releaseAllLocks()
void resetDefaultLocking()
protected void preComplete(java.lang.Integer commitOrAbort) throws StandardException
StandardException
protected void postComplete(int commitflag, java.lang.Integer commitOrAbort) throws StandardException
StandardException
protected void doComplete(java.lang.Integer commitOrAbort) throws StandardException
StandardException
private void checkObserverException() throws StandardException
StandardException
protected boolean doPostCommitWorkInTran()
public boolean handlesPostTerminationWork()
RawTransaction
handlesPostTerminationWork
in class RawTransaction
public void recoveryTransaction()
RawTransaction
recoveryTransaction
in class RawTransaction
private void transferPostCommitorAbortWork(java.util.List<Serviceable> work_list) throws StandardException
StandardException
private final void postTermination() throws StandardException
StandardException
private int getSavePointPosition(java.lang.String name, java.lang.Object kindOfSavepoint, boolean forRollbackOrRelease)
protected boolean popSavePoints(int position, boolean release) throws StandardException
StandardException
- Thrown if a error of severity less than TransactionException#SEVERITY
is encountered during the rollback of this savepoint.public RawTransaction startNestedTopTransaction() throws StandardException
RawTransaction
startNestedTopTransaction
in class RawTransaction
StandardException
- Derby Standard error policyprivate boolean isUserTransaction()
public final boolean isActive()
public final boolean isPrepared()
public boolean isIdle()
isIdle
in interface Transaction
public boolean isPristine()
isPristine
in interface Transaction
public boolean inAbort()
RawTransaction
inAbort
in class RawTransaction
public FileResource getFileHandler()
Transaction
getFileHandler
in interface Transaction
protected int statusForBeginXactLog()
statusForBeginXactLog
in class RawTransaction
protected int statusForEndXactLog()
statusForEndXactLog
in class RawTransaction
void setPostComplete()
public boolean blockBackup(boolean wait) throws StandardException
blockBackup
in class RawTransaction
wait
- if true, waits until the transaction
can block the backup.StandardException
- if interrupted while waiting
for the backup in progress to complete.private void unblockBackup()
public boolean isBlockingBackup()
isBlockingBackup
in class RawTransaction
public void reached(CompatibilitySpace compatibilitySpace, java.lang.Object group, int limit, java.util.Enumeration lockList, int lockCount) throws StandardException
Limit
reached
in interface Limit
compatibilitySpace
- lock space the limit was set forgroup
- lock group the limit was set forlimit
- the limit's settinglockList
- the list of Lockable's in the grouplockCount
- the number of locks in the groupStandardException
- Standard Derby error policy.public void createXATransactionFromLocalTransaction(int format_id, byte[] global_id, byte[] branch_id) throws StandardException
Must only be called a previous local transaction was created and exists in the context. Can only be called if the current transaction is in the idle state, and no current global id.
Simply call setTransactionId() which takes care of error checking.
createXATransactionFromLocalTransaction
in interface Transaction
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()StandardException
- Standard exception policy.public void xa_commit(boolean onePhase) throws StandardException
RESOLVE - how do we map to the "right" XAExceptions.
xa_commit
in interface Transaction
onePhase
- If true, the resource manager should use a one-phase
commit protocol to commit the work done on behalf of
current xid.StandardException
- Standard exception policy.public int xa_prepare() throws StandardException
xa_prepare
in interface Transaction
StandardException
- Standard exception policy.public void xa_rollback() throws StandardException
The given transaction is roll'ed back and it's history is not maintained in the transaction table or long term log.
xa_rollback
in interface Transaction
StandardException
- Standard exception policy.public java.lang.String toString()
The virtual lock table depends on this routine returning just the local transaction id as a string, even if it is a global transaction. Joins between the lock table and the transaction table will not work if this routine returns anything other than myId.toString().
toString
in class java.lang.Object
public java.lang.String toInternalDetailString()
public java.lang.String getActiveStateTxIdString()
getActiveStateTxIdString
in interface Transaction
public DataValueFactory getDataValueFactory() throws StandardException
Return a DataValueFactory that can be used to allocate objects. Used to make calls to: DataValueFactory.getInstanceUsingFormatIdAndCollationType()
getDataValueFactory
in interface Transaction
StandardException
- Standard exception policy.java.lang.String getState()
public java.lang.String getTransName()
public void setTransName(java.lang.String name)
public boolean inRollForwardRecovery()
inRollForwardRecovery
in class RawTransaction
public void checkpointInRollForwardRecovery(LogInstant cinstant, long redoLWM, long undoLWM) throws StandardException
checkpointInRollForwardRecovery
in class RawTransaction
cinstant
- The LogInstant of the checkpointredoLWM
- Redo Low Water Mark in the check point recordundoLWM
- Undo Low Water Mark in the checkpointStandardException
public boolean isNestedOwner()
LockOwner
Return true if this is a nested owner, e.g., a nested user transaction.
isNestedOwner
in interface LockOwner
public boolean nestsUnder(LockOwner other)
LockOwner
Return true if this owner nests under another owner.
nestsUnder
in interface LockOwner
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.