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

public Class CompressSpacePageOperation

extends PhysicalPageOperation
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.store.raw.data.CompressSpacePageOperation10_2
Imports
org.apache.derby.iapi.services.io.StoredFormatIds, .CompressedNumber, .LimitObjectInput, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.raw.Transaction, org.apache.derby.iapi.store.raw.log.LogInstant, java.io.ObjectOutput, .IOException, .ObjectInput

Log operation to implement compressing space from a container and returning it to the operating system.

Field Summary

Modifier and TypeField and Description
protected int
newHighestPage

The new highest page on this allocation page.

protected int
num_pages_truncated

The number of allocated pages in this allocation page prior to the truncate.

Constructor Summary

AccessConstructor and Description
pack-priv
CompressSpacePageOperation(AllocPage allocPage, int highest_page, int num_truncated)

Constructors for This class:

public
CompressSpacePageOperation()

Public Methods of Formatable interface.

Method Summary

Modifier and TypeMethod and Description
public final void
doMe(Transaction
transaction doing the operation.
tran
,
LogInstant
log instant for this operation.
instant
,
LimitObjectInput
unused by this log operation.
in
)

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

Compress space from container.

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.

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
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 String
public void
undoMe(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.PhysicalPageOperation.undoMe.

Compress space undo.

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

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

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 org.apache.derby.impl.store.raw.data.PhysicalPageOperation:
generateUndo

Field Detail

newHighestPageback to summary
protected int newHighestPage

The new highest page on this allocation page. The number is the offset of the page in the array of pages maintained by this allocation page, for instance a value of 0 indicates all page except the first one are to be truncated. If all pages are truncated then the offset is set to -1.

num_pages_truncatedback to summary
protected int num_pages_truncated

The number of allocated pages in this allocation page prior to the truncate. Note that all pages from NewHighestPage+1 through newHighestPage+num_pages_truncated should be FREE.

Constructor Detail

CompressSpacePageOperationback to summary
pack-priv CompressSpacePageOperation(AllocPage allocPage, int highest_page, int num_truncated) throws StandardException

Constructors for This class:

CompressSpacePageOperationback to summary
public CompressSpacePageOperation()

Public Methods of Formatable interface.

Method Detail

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

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

Compress space from container.

Compress the indicate space from the container, returning the free pages to the OS. Update the allocation page to reflect the file change.

Parameters
tran:Transaction

transaction doing the operation.

instant:LogInstant

log instant for this operation.

in:LimitObjectInput

unused by this log operation.

Exceptions
StandardException:
Standard exception policy.
getTypeFormatIdback to summary
public int getTypeFormatId()

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

Return my format identifier.

Returns:int

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

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

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.

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:
error reading from log stream
ClassNotFoundException:
cannot read object from input
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

toStringback to summary
public String toString()

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

debug

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

undoMeback to summary
public void undoMe(Transaction xact, BasePage undoPage, LogInstant CLRInstant, LimitObjectInput in) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

Compress space undo.

Parameters
xact:Transaction

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the Transaction doing the rollback

undoPage:BasePage

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the page to rollback changes on

CLRInstant:LogInstant

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the log instant of this (PageUndo) operation

in:LimitObjectInput

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

optional data for the rollback operation

Exceptions
StandardException:
Thrown by methods I call
See Also
PhysicalPageOperation#undoMe
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.

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