java.io.Externalizable
, java.io.Serializable
, Formatable
, TypedFormat
, Loggable
, LogicalUndoable
, RePreparable
, Undoable
DeleteOperation
, InsertOperation
, UpdateFieldOperation
abstract class LogicalPageOperation extends PageBasicOperation implements LogicalUndoable
Format ID | no format id, an abstract class. |
Purpose | |
provide methods for logical undo | |
Upgrade | |
Disk Layout | PageBasicOperation the super class recordId(CompressedInt) the recordId this operation affects undo(LogicalUndo) the piece of code that can figure out which page the row has moved into OptionalData none |
Modifier and Type | Field | Description |
---|---|---|
protected int |
recordId |
|
protected LogicalUndo |
undo |
ABORT, BI_LOG, CHECKSUM, COMMIT, COMPENSATION, FILE_RESOURCE, FIRST, LAST, PREPARE, RAWSTORE, XA_NEEDLOCK
containerHdl, foundHere, page
Constructor | Description |
---|---|
LogicalPageOperation() |
|
LogicalPageOperation(BasePage page,
LogicalUndo undo,
int recordId) |
Modifier and Type | Method | Description |
---|---|---|
private BasePage |
findLogicalPage(Transaction xact,
LogicalUndo undo,
LimitObjectInput in) |
Find the page that the rollback operation should be applied to.
|
Compensation |
generateUndo(Transaction xact,
LimitObjectInput in) |
Generate a Compensation (PageUndoOperation) that will rollback the
changes of this page operation.
|
ContainerHandle |
getContainer() |
Return the container handle where the log operated on
|
RecordHandle |
getRecordHandle() |
Return the record handle that correspond to the record that was changed
during roll forward.
|
void |
readExternal(java.io.ObjectInput in) |
Read this in
|
void |
reclaimPrepareLocks(Transaction t,
LockingPolicy locking_policy) |
reclaim locks associated with the changes in this log record.
|
void |
resetRecordHandle(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
|
abstract void |
undoMe(Transaction xact,
BasePage undoPage,
int undoRecordId,
LogInstant CLRinstant,
LimitObjectInput in) |
Undo the change indicated by this log operation and optional data.
|
void |
writeExternal(java.io.ObjectOutput out) |
doMe, getPreparedLog, group, needsRedo, releaseResource
restoreLoggedRow
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findpage, getPage, getPageForRedoRecovery, getPageId, getPageVersion, getPreparedLog, group, needsRedo, releaseResource, resetPageNumber, restoreMe, toString
getTypeFormatId
protected LogicalUndo undo
protected int recordId
public LogicalPageOperation()
LogicalPageOperation(BasePage page, LogicalUndo undo, int recordId)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class PageBasicOperation
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class PageBasicOperation
java.io.IOException
- error reading from log streamjava.lang.ClassNotFoundException
- log stream corruptedpublic Compensation generateUndo(Transaction xact, LimitObjectInput in) throws StandardException, java.io.IOException
generateUndo
in interface Undoable
xact
- the transaction doing the rollbackStandardException
- Standard Derby policy.java.io.IOException
- Method may read from ObjectInputLogicalUndo
public ContainerHandle getContainer()
getContainer
in interface LogicalUndoable
public void resetRecordHandle(RecordHandle rh)
resetRecordHandle
in interface LogicalUndoable
rh
- the RecordHandle that represents the row's new locationpublic RecordHandle getRecordHandle()
getRecordHandle
in interface LogicalUndoable
public void reclaimPrepareLocks(Transaction t, LockingPolicy locking_policy) throws StandardException
reclaimPrepareLocks
in interface RePreparable
reclaimPrepareLocks
in class PageBasicOperation
locking_policy
- The locking policy to use to claim the locks.StandardException
- Standard exception policy.private BasePage findLogicalPage(Transaction xact, LogicalUndo undo, LimitObjectInput in) throws StandardException, java.io.IOException
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.
xact
- the transaction doing the compensatingin
- optional inputStandardException
- Standard Derby error policyjava.io.IOException
- Method may read from ObjectInputPageBasicOperation
,
Undoable.generateUndo(org.apache.derby.iapi.store.raw.Transaction, org.apache.derby.iapi.services.io.LimitObjectInput)
,
Loggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction)
public abstract void undoMe(Transaction xact, BasePage undoPage, int undoRecordId, LogInstant CLRinstant, LimitObjectInput in) throws StandardException, java.io.IOException
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.
xact
- the Transaction doing the rollbackundoPage
- the page to rollback changes onundoRecordId
- the recordId to rollback changes onCLRinstant
- the log instant of this (PageUndo) operationin
- optional data for the rollback operationjava.io.IOException
- Can be thrown by any of the methods of ObjectInput.StandardException
- Standard Derby policy.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.