Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.data

public final Class LogicalUndoOperation

extends PageBasicOperation
implements Compensation
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.Compensation, org.apache.derby.iapi.store.raw.Loggable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
org.apache.derby.iapi.services.io.StoredFormatIds, .CompressedNumber, .LimitObjectInput, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.store.raw.Compensation, .Loggable, .Transaction, .Undoable, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.util.ByteArray, java.io.ObjectOutput, .ObjectInput, .IOException

LogicalUndoOperation is a compensation operation that rolls back the change of an LogicalUndoable operation. A LogicalUndoOperation itself is not undo-able, i.e, it is loggable but not undoable.

Field Summary

Modifier and TypeField and Description
protected int
private transient LogicalPageOperation
undoOp

The operation to be rolled back

Inherited from org.apache.derby.impl.store.raw.data.PageBasicOperation:
containerHdlfoundHerepage

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
LogicalUndoOperation(BasePage page, int recordId, LogicalPageOperation op)

Set up a compensation operation during run time rollback

public
LogicalUndoOperation()

Return my format identifier.

Method Summary

Modifier and TypeMethod and Description
public final void
doMe(Transaction
the Transaction that is doing the rollback
xact
,
LogInstant
the log instant of this undo operation
instant
,
LimitObjectInput
optional data
in
)

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Apply the undo operation, in this implementation of the RawStore, it can only call the undoMe method of undoOp

public final ByteArray
getPreparedLog()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.getPreparedLog.

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray.

public int
getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get a universally unique identifier for the type of this object.

public int
public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.readExternal.

Implements java.io.Externalizable.readExternal.

Read this in

public void
releaseResource(Transaction xact)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.releaseResource.

Implements org.apache.derby.iapi.store.raw.Loggable.releaseResource.

Release any resource that was acquired for doMe for rollback or recovery redo.

public void
restoreMe(Transaction
the Transaction doing the rollback
xact
,
BasePage
the page to rollback changes on
undoPage
,
LogInstant
the log instant of this (PageUndo) operation
CLRinstant
,
LimitObjectInput
optional data for the rollback operation
in
)

Implements abstract org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

Undo the change indicated by this log operation and optional data.

public void
setUndoOp(Undoable
the Undoable operation
op
)

Implements org.apache.derby.iapi.store.raw.Compensation.setUndoOp.

Set up a LogicalOperation during recovery redo.

public String
public void
Inherited from org.apache.derby.impl.store.raw.data.PageBasicOperation:
findpagegetPagegetPageForRedoRecoverygetPageIdgetPageVersionneedsRedoreclaimPrepareLocksresetPageNumber

Field Detail

recordIdback to summary
protected int recordId
undoOpback to summary
private transient LogicalPageOperation undoOp

The operation to be rolled back

Constructor Detail

LogicalUndoOperationback to summary
pack-priv LogicalUndoOperation(BasePage page)
LogicalUndoOperationback to summary
pack-priv LogicalUndoOperation(BasePage page, int recordId, LogicalPageOperation op)

Set up a compensation operation during run time rollback

LogicalUndoOperationback to summary
public LogicalUndoOperation()

Return my format identifier.

Method Detail

doMeback to summary
public final void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Apply the undo operation, in this implementation of the RawStore, it can only call the undoMe method of undoOp

Parameters
xact:Transaction

the Transaction that is doing the rollback

instant:LogInstant

the log instant of this undo operation

in:LimitObjectInput

optional data

Exceptions
StandardException:
Standard Derby policy.
IOException:
Can be thrown by any of the methods of ObjectInput.
getPreparedLogback to summary
public final ByteArray getPreparedLog()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.getPreparedLog.

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

Doc from org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray. The ByteArray can be prepared when the log operation is constructed, or it can be prepared when getPreparedLog() is called. Called by the log manager to allow the log operation to pass the buffer which contains optional data that will be available in to doMe() methods.

getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get a universally unique identifier for the type of this object.

Returns:int

The identifier. (A UUID stuffed in an array of 16 bytes).

groupback to summary
public int group()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.group.

Implements org.apache.derby.iapi.store.raw.Loggable.group.

Doc from org.apache.derby.iapi.store.raw.Loggable.group.

Get the loggable's group value

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.readExternal.

Implements java.io.Externalizable.readExternal.

Read this in

Parameters
in:ObjectInput

Doc from java.io.Externalizable.readExternal.

the stream to read data from in order to restore the object

Exceptions
IOException:
error reading from log stream
ClassNotFoundException:
log stream corrupted
releaseResourceback to summary
public void releaseResource(Transaction xact)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.releaseResource.

Implements org.apache.derby.iapi.store.raw.Loggable.releaseResource.

Doc from org.apache.derby.iapi.store.raw.Loggable.releaseResource.

Release any resource that was acquired for doMe for rollback or recovery redo. This resource is acquired in either generateUndo (if this is a compensation operation during run time rollback or recovery rollback) or in needsRedo (if this is during recovery redo). The run time transaction context should have all the resource already acquird for run time roll forward, so there is no need to releaseResource during run time roll forward. This method must be safe to be called multiple times.

restoreMeback to summary
public void restoreMe(Transaction xact, BasePage undoPage, LogInstant CLRinstant, LimitObjectInput in)

Implements abstract org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

Doc from org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

Undo the change indicated by this log operation and optional data. The page the undo should apply to is the latched undoPage. The undoPage must be the same page as the doMe page and the undo operation must restore the before image of the row that changed.
this can only be used under special circumstances: namely table level locking, and no internal or nested transaction, and all operations are rollec back with restoreMe instead of undoMe.
This method is here to support BeforeImageLogging

Parameters
xact:Transaction

the Transaction doing the rollback

undoPage:BasePage

the page to rollback changes on

CLRinstant:LogInstant

the log instant of this (PageUndo) operation

in:LimitObjectInput

optional data for the rollback operation

setUndoOpback to summary
public void setUndoOp(Undoable op)

Implements org.apache.derby.iapi.store.raw.Compensation.setUndoOp.

Set up a LogicalOperation during recovery redo.

Parameters
op:Undoable

Doc from org.apache.derby.iapi.store.raw.Compensation.setUndoOp.

the Undoable operation

toStringback to summary
public String toString()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.toString.

DEBUG: Print self.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.writeExternal.

Implements java.io.Externalizable.writeExternal.

Write this out.

Parameters
out:ObjectOutput

Doc from java.io.Externalizable.writeExternal.

the stream to write the object to

Exceptions
IOException:
error writing to log stream