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

public abstract Class RawTransaction

extends DerbyObservable
implements Transaction
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.Transaction
Known Direct Subclasses
org.apache.derby.impl.store.raw.xact.Xact
Imports
org.apache.derby.iapi.store.raw.ContainerKey, .Compensation, .LockingPolicy, .Loggable, .Transaction, .GlobalTransactionId, org.apache.derby.iapi.services.locks.LockFactory, org.apache.derby.iapi.services.monitor.DerbyObservable, org.apache.derby.iapi.store.raw.data.DataFactory, .RawContainerHandle, org.apache.derby.iapi.store.raw.log.LogInstant, .LogFactory, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.util.ByteArray, org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream, .LimitObjectInput

RawTransaction is the form of Transaction used within the raw store. This allows the break down of RawStore functionality into (at least) three modules (Transactions, Data, Log) without exposing internal information on the external interface.

The transaction will notify any Observer's just before the transaction is committed, aborted or a rollback to savepoint occurs. The argument passed to the update() method of the Observer's will be one of

The observer's must perform a value equality check (equals()) on the update arg to see why it is being notified.
See Also
java.util.Observer

Field Summary

Modifier and TypeField and Description
public static final Integer
public static final Integer
public static final Integer
protected StandardException
public static final Integer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
addUpdateTransaction(int transactionStatus)

Add this raw transaction on to the list of update transaction

public abstract boolean

Returns:

true if the transaction blocked the backup. false otherwise.
blockBackup
(boolean
if true, waits until the transaction can block the backup.
wait
)

Make the transaction block the online backup.

public void
checkLogicalOperationOk()

Check to see if a logical operation is allowed by this transaction, throws a TransactionExceotion if it isn't.

public abstract void
checkpointInRollForwardRecovery(LogInstant
The LogInstant of the checkpoint
cinstant
,
long
Redo Low Water Mark in the check point record
redoLWM
,
long
Undo Low Water Mark in the checkpoint
undoLWM
)

Redo a checkpoint during rollforward recovery.

public abstract DataFactory
getDataFactory()

Get the data factory to be used during this transaction.

public abstract LogInstant
getFirstLogInstant()

Get the log instant for the first log record written by this transaction.

public abstract GlobalTransactionId
getGlobalId()

Redeclares org.apache.derby.iapi.store.raw.Transaction.getGlobalId.

Get the shortId of this transaction.

public abstract TransactionId
getId()

Get the shortId of this transaction.

public abstract LogInstant
getLastLogInstant()

Get the log instant for the last log record written by this transaction.

public abstract LockFactory
getLockFactory()

Get the lock factory to be used during this transaction.

public abstract DynamicByteArrayOutputStream
getLogBuffer()

Get the log buffer to be used during this transaction.

public abstract LogFactory
getLogFactory()

Get the log factory to be used during this transaction.

public abstract boolean
handlesPostTerminationWork()

Can this transaction handles post termination work

public abstract boolean
inAbort()

Is the transaction in the middle of an abort.

public abstract boolean
inRollForwardRecovery()

Retunrs true if the transaction is part of rollforward recovery

public abstract boolean

Returns:

true if this transaction is blocking the backup, otherwise false
isBlockingBackup
()

Check if the transaction is blocking the backup ?

public abstract void
logAndUndo(Compensation
the Compensation Operation
compensation
,
LogInstant
the LogInstant of the Loggable Operation this compensation operation is going to roll back
undoInstant
,
LimitObjectInput
optional data for the rollback operation
in
)

Log a compensation operation and then action it in the context of this transaction.

public void
notifyObservers(Object
Extra information to be passed to the observer's callback method.
arg
)

Overrides org.apache.derby.iapi.services.monitor.DerbyObservable.notifyObservers.

Allow my users to notigy my observers.

public abstract RawContainerHandle
openDroppedContainer(ContainerKey containerId, LockingPolicy locking)

Open a container that may be dropped - use only by logging and recovery.

public abstract void
prepareTransaction()

Change the state of transaction in table to prepare.

public boolean
recoveryRollbackFirst()

Return true if this transaction should be rolled back first in recovery.

public abstract void
recoveryTransaction()

Make this transaction aware that it is being used by recovery

public abstract void
reCreateContainerForRedoRecovery(long segmentId, long containerId, ByteArray containerInfo)

Recreate a container during redo recovery.

public abstract void
removeUpdateTransaction()

Remove this raw transaction from the list of update transaction

public abstract void
reprepare()

During recovery re-prepare a transaction.

public abstract void
setFirstLogInstant(LogInstant instant)

Set the log instant for the first log record written by this transaction.

public abstract void
setLastLogInstant(LogInstant instant)

Set the log instant for the last log record written by this transaction.

public void
setObserverException(StandardException se)

Allow an Observer to indicate an exception to the transaction that is raised in its update() method.

public abstract void
setTransactionId(Loggable beginXact, TransactionId shortId)

Set the transactionId (Global and internal) of this transaction using a log record that contains the Global id

public abstract RawTransaction
startNestedTopTransaction()

Start a nested top transaction.

protected abstract int
statusForBeginXactLog()

Status that needs to go into the begin transaction log record, if there is one, to help with recovery

protected abstract int
statusForEndXactLog()

Status that needs to go into the end transaction log record, if there is one, to help with recovery

Inherited from org.apache.derby.iapi.services.monitor.DerbyObservable:
addObservercountObserversdeleteObservernotifyObserverssetChanged

Field Detail

ABORTback to summary
public static final Integer ABORT
COMMITback to summary
public static final Integer COMMIT
LOCK_ESCALATEback to summary
public static final Integer LOCK_ESCALATE
observerExceptionback to summary
protected StandardException observerException
SAVEPOINT_ROLLBACKback to summary
public static final Integer SAVEPOINT_ROLLBACK

Constructor Detail

RawTransactionback to summary
public RawTransaction()

Method Detail

addUpdateTransactionback to summary
public abstract void addUpdateTransaction(int transactionStatus)

Add this raw transaction on to the list of update transaction

blockBackupback to summary
public abstract boolean blockBackup(boolean wait) throws StandardException

Make the transaction block the online backup.

Parameters
wait:boolean

if true, waits until the transaction can block the backup.

Returns:boolean

true if the transaction blocked the backup. false otherwise.

Exceptions
StandardException:
if interrupted while waiting for the backup in progress to complete.
checkLogicalOperationOkback to summary
public void checkLogicalOperationOk() throws StandardException

Check to see if a logical operation is allowed by this transaction, throws a TransactionExceotion if it isn't. This implementation allows logical operations. Transactions that need to disallow logical operations should hide this method.

Exceptions
StandardException:
Standard Derby error policy,
checkpointInRollForwardRecoveryback to summary
public abstract void checkpointInRollForwardRecovery(LogInstant cinstant, long redoLWM, long undoLWM) throws StandardException

Redo a checkpoint during rollforward recovery.

Parameters
cinstant:LogInstant

The LogInstant of the checkpoint

redoLWM:long

Redo Low Water Mark in the check point record

undoLWM:long

Undo Low Water Mark in the checkpoint

Exceptions
StandardException:
Exception encountered during checkpoint
getDataFactoryback to summary
public abstract DataFactory getDataFactory()

Get the data factory to be used during this transaction.

getFirstLogInstantback to summary
public abstract LogInstant getFirstLogInstant()

Get the log instant for the first log record written by this transaction.

getGlobalIdback to summary
public abstract GlobalTransactionId getGlobalId()

Redeclares org.apache.derby.iapi.store.raw.Transaction.getGlobalId.

Get the shortId of this transaction. May return null if transactio has no ID.

getIdback to summary
public abstract TransactionId getId()

Get the shortId of this transaction. May return null if transactio has no ID.

getLastLogInstantback to summary
public abstract LogInstant getLastLogInstant()

Get the log instant for the last log record written by this transaction. If the transaction is unclear what its last log instant is, than it may return null.

getLockFactoryback to summary
public abstract LockFactory getLockFactory()

Get the lock factory to be used during this transaction.

getLogBufferback to summary
public abstract DynamicByteArrayOutputStream getLogBuffer()

Get the log buffer to be used during this transaction.

getLogFactoryback to summary
public abstract LogFactory getLogFactory()

Get the log factory to be used during this transaction.

handlesPostTerminationWorkback to summary
public abstract boolean handlesPostTerminationWork()

Can this transaction handles post termination work

inAbortback to summary
public abstract boolean inAbort()

Is the transaction in the middle of an abort.

inRollForwardRecoveryback to summary
public abstract boolean inRollForwardRecovery()

Retunrs true if the transaction is part of rollforward recovery

isBlockingBackupback to summary
public abstract boolean isBlockingBackup()

Check if the transaction is blocking the backup ?

Returns:boolean

true if this transaction is blocking the backup, otherwise false

logAndUndoback to summary
public abstract void logAndUndo(Compensation compensation, LogInstant undoInstant, LimitObjectInput in) throws StandardException

Log a compensation operation and then action it in the context of this transaction. The CompensationOperation is logged in the transaction log file and then its doMe method is called to perform the required change. This compensation operation will rollback the change that was done by the Loggable Operation at undoInstant.

Parameters
compensation:Compensation

the Compensation Operation

undoInstant:LogInstant

the LogInstant of the Loggable Operation this compensation operation is going to roll back

in:LimitObjectInput

optional data for the rollback operation

Exceptions
StandardException:
Standard Derby exception policy
See Also
Compensation
notifyObserversback to summary
public void notifyObservers(Object arg)

Overrides org.apache.derby.iapi.services.monitor.DerbyObservable.notifyObservers.

Allow my users to notigy my observers.

Parameters
arg:Object

Doc from org.apache.derby.iapi.services.monitor.DerbyObservable.notifyObservers.

Extra information to be passed to the observer's callback method.

openDroppedContainerback to summary
public abstract RawContainerHandle openDroppedContainer(ContainerKey containerId, LockingPolicy locking) throws StandardException

Open a container that may be dropped - use only by logging and recovery. During recovery redo, a log record may refer to a container that has long been dropped. This interface is provided so a dropped container may be opened. If the container has been dropped and is known to be committed, then even if we open the dropped container with forUpdate true, the container will be silently opened as read only. Logging and recovery code always check for committed drop status. Anybody else wanting to use this interface must keep this in mind.

Exceptions
StandardException:
Standard Derby exception policy
prepareTransactionback to summary
public abstract void prepareTransaction()

Change the state of transaction in table to prepare.

recoveryRollbackFirstback to summary
public boolean recoveryRollbackFirst()

Return true if this transaction should be rolled back first in recovery. This implementation returns false. Transactions that need to rollback first during recovery should hide this method.

recoveryTransactionback to summary
public abstract void recoveryTransaction()

Make this transaction aware that it is being used by recovery

reCreateContainerForRedoRecoveryback to summary
public abstract void reCreateContainerForRedoRecovery(long segmentId, long containerId, ByteArray containerInfo) throws StandardException

Recreate a container during redo recovery. Used during redo recovery when processing log records trying to create a container, but no container is found in the db.

Exceptions
StandardException:
Standard Derby exception policy
removeUpdateTransactionback to summary
public abstract void removeUpdateTransaction()

Remove this raw transaction from the list of update transaction

reprepareback to summary
public abstract void reprepare() throws StandardException

During recovery re-prepare a transaction.

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.

Exceptions
StandardException:
Standard exception policy.
setFirstLogInstantback to summary
public abstract void setFirstLogInstant(LogInstant instant)

Set the log instant for the first log record written by this transaction.

setLastLogInstantback to summary
public abstract void setLastLogInstant(LogInstant instant)

Set the log instant for the last log record written by this transaction.

setObserverExceptionback to summary
public void setObserverException(StandardException se)

Allow an Observer to indicate an exception to the transaction that is raised in its update() method.

setTransactionIdback to summary
public abstract void setTransactionId(Loggable beginXact, TransactionId shortId)

Set the transactionId (Global and internal) of this transaction using a log record that contains the Global id

startNestedTopTransactionback to summary
public abstract RawTransaction startNestedTopTransaction() throws StandardException

Start a nested top transaction. A nested top transaction behaves exactly like a user transaction. Nested top transaction allow system type work to proceed in a separate transaction to the current user transaction and be committed independently of the user transaction (usually before the user transaction). Only one nested top transaction can be active in a context at any one time. After a commit the transaction may be re-used. A nested top transaction conflicts on the logical locks of its "parent" transaction.

Exceptions
StandardException:
Standard Derby error policy
statusForBeginXactLogback to summary
protected abstract int statusForBeginXactLog()

Status that needs to go into the begin transaction log record, if there is one, to help with recovery

statusForEndXactLogback to summary
protected abstract int statusForEndXactLog()

Status that needs to go into the end transaction log record, if there is one, to help with recovery