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

pack-priv abstract Class PageBasicOperation

extends Object
implements Loggable, RePreparable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.RePreparable, 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
Known Direct Subclasses
org.apache.derby.impl.store.raw.data.PhysicalPageOperation, org.apache.derby.impl.store.raw.data.PhysicalUndoOperation, org.apache.derby.impl.store.raw.data.SetReservedSpaceOperation, org.apache.derby.impl.store.raw.data.LogicalPageOperation, org.apache.derby.impl.store.raw.data.LogicalUndoOperation
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.store.raw.LockingPolicy, .Loggable, .Page, .RePreparable, .Transaction, .PageKey, .RawStoreFactory, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.data.RawContainerHandle, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.CompressedNumber, .LimitObjectInput, org.apache.derby.iapi.util.ByteArray, org.apache.derby.iapi.services.property.PropertyUtil, java.io.ObjectOutput, .ObjectInput, .IOException

A PageBasicOperation changed the content of a page, this is the root class of all page oriented operation. Each PageBasicOperation record change(s) that apply to one and only one page. The pageID that is changed must be recorded in the log operation - in other words, redo must be physical (or more correctly, in Gray's term, physiological, since changes are logical within a page).
Undo can be logical, but the undo logic must be hidden in generateUndo. By the time a compensation operation is logged as a LogOperation, the page that needs roll back must be determined.
See Also
Loggable

Field Summary

Modifier and TypeField and Description
protected transient RawContainerHandle
protected transient boolean
protected transient BasePage
private PageKey
private long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final BasePage

Returns:

null if container is dropped and committed (possibly stubbified), else return the latched page
findpage
(Transaction xact)

Find the page the operation applies to and latch it, this only uses the segmentId, containerId, and pageId stored in this log record to find the page.

public final Page
protected BasePage
getPageForRedoRecovery(Transaction xact)

Subclass (e.g., init page) that wishes to do something about missing pages in load tran should override this method to return the page

protected final PageKey
public final long
public ByteArray
getPreparedLog()

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

the default for optional data is set to null.

public int
group()

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

A page operation is a RAWSTORE log record

public final boolean
needsRedo(Transaction
The transaction trying to redo this operation
xact
)

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

Returns true if this op should be redone during recovery redo, if so, get and latched the page.

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

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

public void
reclaimPrepareLocks(Transaction t, LockingPolicy locking_policy)

Implements org.apache.derby.iapi.store.raw.RePreparable.reclaimPrepareLocks.

reclaim locks associated with the changes in this log record.

public void
releaseResource(Transaction xact)

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

Release latched page and any other resources acquired during a previous findpage, safe to call multiple times.</nl>

protected final void
resetPageNumber(long pageNumber)

Reset the pageNumber

public abstract 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
)

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

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

containerHdlback to summary
protected transient RawContainerHandle containerHdl
foundHereback to summary
protected transient boolean foundHere
pageback to summary
protected transient BasePage page
pageIdback to summary
private PageKey pageId
pageVersionback to summary
private long pageVersion

Constructor Detail

PageBasicOperationback to summary
pack-priv PageBasicOperation(BasePage page)
PageBasicOperationback to summary
pack-priv PageBasicOperation()

Method Detail

findpageback to summary
public final BasePage findpage(Transaction xact) throws StandardException

Find the page the operation applies to and latch it, this only uses the segmentId, containerId, and pageId stored in this log record to find the page.

Returns:BasePage

null if container is dropped and committed (possibly stubbified), else return the latched page

Exceptions
StandardException:
Standard Derby policy.
getPageback to summary
public final Page getPage()
getPageForRedoRecoveryback to summary
protected BasePage getPageForRedoRecovery(Transaction xact) throws StandardException

Subclass (e.g., init page) that wishes to do something about missing pages in load tran should override this method to return the page

Exceptions
StandardException:
Derby Standard error policy
getPageIdback to summary
protected final PageKey getPageId()
getPageVersionback to summary
public final long getPageVersion()
getPreparedLogback to summary
public ByteArray getPreparedLog() throws StandardException

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

the default for optional data is set to null. If an operation has optional data, the operation need to prepare the optional data for this method.

Warning

If a log operation extends this class, and the operation has optional data, it MUST overwrite this method to return a ByteArray that contains the optional data.

Exceptions
StandardException:
Standard Derby policy.
groupback to summary
public int group()

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

A page operation is a RAWSTORE log record

needsRedoback to summary
public final boolean needsRedo(Transaction xact) throws StandardException

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

Returns true if this op should be redone during recovery redo, if so, get and latched the page.

Parameters
xact:Transaction

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

The transaction trying to redo this operation

Returns:boolean

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

true if operation needs redoing, false if not.

Exceptions
StandardException:
Standard Derby policy.
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

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

Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
If the class for an object being restored cannot be found.
reclaimPrepareLocksback to summary
public void reclaimPrepareLocks(Transaction t, LockingPolicy locking_policy) throws StandardException

Implements org.apache.derby.iapi.store.raw.RePreparable.reclaimPrepareLocks.

reclaim locks associated with the changes in this log record.

Exceptions
StandardException:
Standard exception policy.
releaseResourceback to summary
public void releaseResource(Transaction xact)

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

Release latched page and any other resources acquired during a previous findpage, safe to call multiple times. In this RawStore implementataion, resource is acquired by a log operation in one of two places

  • during runtime or recovery undo in PageOperation.generateUndo()
  • during recovery redo in PageBasicOperation.needsRedo()
  • resetPageNumberback to summary
    protected final void resetPageNumber(long pageNumber)

    Reset the pageNumber

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

    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

    Exceptions
    StandardException:
    Standard Derby policy.
    IOException:
    Can be thrown by any of the methods of ObjectInput.
    toStringback to summary
    public String toString()

    Overrides java.lang.Object.toString.

    Doc from java.lang.Object.toString.

    Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

    Returns:String

    a string representation of the object

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

    Implements java.io.Externalizable.writeExternal.

    Doc from java.io.Externalizable.writeExternal.

    The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

    Parameters
    out:ObjectOutput

    the stream to write the object to

    Exceptions
    IOException:
    Includes any I/O exceptions that may occur