java.lang.Object
org.apache.derby.impl.store.raw.data.PageBasicOperation
org.apache.derby.impl.store.raw.data.LogicalPageOperation
- All Implemented Interfaces:
- java.io.Externalizable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.store.raw.Loggable, org.apache.derby.iapi.store.raw.LogicalUndoable, org.apache.derby.iapi.store.raw.RePreparable, java.io.Serializable, org.apache.derby.iapi.services.io.TypedFormat, org.apache.derby.iapi.store.raw.Undoable
- Direct Known Subclasses:
- DeleteOperation, InsertOperation, UpdateFieldOperation
- public abstract class LogicalPageOperation
- extends PageBasicOperation
- implements org.apache.derby.iapi.store.raw.LogicalUndoable
An abstract class that is used for logical log operation. A logical log
operation is one where the undo of the operation may be applied to a
different page than the original operation.
| Fields inherited from interface org.apache.derby.iapi.store.raw.Loggable |
ABORT, BI_LOG, CHECKSUM, COMMIT, COMPENSATION, FILE_RESOURCE, FIRST, LAST, PREPARE, RAWSTORE, XA_NEEDLOCK |
| Methods inherited from class org.apache.derby.impl.store.raw.data.PageBasicOperation |
findpage, getPage, getPageForLoadTran, getPageId, getPageVersion, getPreparedLog, group, needsRedo, releaseResource, resetPageNumber, restoreMe, toString |
undo
protected org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo
recordId
protected int recordId
LogicalPageOperation
public LogicalPageOperation()
LogicalPageOperation
protected LogicalPageOperation(BasePage page,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo,
int recordId)
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Description copied from interface:
java.io.Externalizable
- This method is responsible for writing the instance data of an object
to the passed in stream. Note that this stream is not a subclass of
OutputStream, but rather is a class that implements the
ObjectOutput interface. That interface provides a
number of methods
for writing Java data values to a stream.
Not that the implementation of this method must be coordinated with
the implementation of readExternal.
- Specified by:
writeExternal in interface java.io.Externalizable- Overrides:
writeExternal in class PageBasicOperation
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Read this in
- Specified by:
readExternal in interface java.io.Externalizable- Overrides:
readExternal in class PageBasicOperation
generateUndo
public org.apache.derby.iapi.store.raw.Compensation generateUndo(org.apache.derby.iapi.store.raw.Transaction xact,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Generate a Compensation (PageUndoOperation) that will rollback the
changes of this page operation. If this Page operation cannot or need not
be rolled back (redo only), overwrite this function to return null.
- Specified by:
generateUndo in interface org.apache.derby.iapi.store.raw.Undoable
getContainer
public org.apache.derby.iapi.store.raw.ContainerHandle getContainer()
- Return the container handle where the log operated on
- Specified by:
getContainer in interface org.apache.derby.iapi.store.raw.LogicalUndoable
resetRecordHandle
public void resetRecordHandle(org.apache.derby.iapi.store.raw.RecordHandle rh)
- After the logical undo logic figures out where the real record that
needs roll back is, reset this log operation to refer to that record
- Specified by:
resetRecordHandle in interface org.apache.derby.iapi.store.raw.LogicalUndoable
getRecordHandle
public org.apache.derby.iapi.store.raw.RecordHandle getRecordHandle()
- Return the record handle that correspond to the record that was changed
during roll forward. This is used as a hint by logical undo as a good
place to look for the record to apply the roll back.
- Specified by:
getRecordHandle in interface org.apache.derby.iapi.store.raw.LogicalUndoable
reclaimPrepareLocks
public void reclaimPrepareLocks(org.apache.derby.iapi.store.raw.Transaction t,
org.apache.derby.iapi.store.raw.LockingPolicy locking_policy)
throws org.apache.derby.iapi.error.StandardException
- reclaim locks associated with the changes in this log record.
- Specified by:
reclaimPrepareLocks in interface org.apache.derby.iapi.store.raw.RePreparable- Overrides:
reclaimPrepareLocks in class PageBasicOperation
findLogicalPage
private BasePage findLogicalPage(org.apache.derby.iapi.store.raw.Transaction xact,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Find the page that the rollback operation should be applied to.
The actual logical log operation is expected to implement
Undoable.generateUndo. This utility function findLogicalPage is provided
for the common case scenario of using a LogicalUndo interface to find the
undo page. The subclass that implements Undoable.generateUndo can use
this function to find the logical page with its LogicalUndo callback function.
This method can be used with the default releaseResource().
During recovery redo, the logging system is page oriented and will use
the pageID stored in the PageUndoOperation to find the page. The
page will be latched and released using the default findpage and
releaseResource - this.releaseResource() will still be called so it has
to know not to release any resource it did not acquire.
undoMe
public abstract void undoMe(org.apache.derby.iapi.store.raw.Transaction xact,
BasePage undoPage,
int undoRecordId,
org.apache.derby.iapi.store.raw.log.LogInstant CLRinstant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Undo the change indicated by this log operation and optional data.
The undoPage and undoRecordId is the page, record the undo should apply to.
The undoRecorId differs from the roll forward recordId if the undoPage
differs from the page the roll forward operation was applied to, in
other words, the record moved to another page and the recordId changed.
A logical operation can at most deal with 1 record.
The available() method of in indicates how much data can be read, i.e.
how much was originally written.
In this RawStore implementation, should only only be called via
CompOp.doMe.