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

public abstract Class ContainerBasicOperation

extends Object
implements Loggable
Class Inheritance
All Implemented Interfaces
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.ContainerOperation, org.apache.derby.impl.store.raw.data.ContainerUndoOperation
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.store.raw.ContainerKey, .ContainerHandle, .Loggable, .LockingPolicy, .Transaction, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.data.RawContainerHandle, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.CompressedNumber, org.apache.derby.iapi.util.ByteArray, java.io.OutputStream, .ObjectInput, .ObjectOutput, .IOException

A Container Operation change the state of the container. A ContainerBasicOperation is the base class for all container operations.

Field Summary

Modifier and TypeField and Description
protected transient RawContainerHandle
protected ContainerKey
private long
private transient boolean

Constructor Summary

AccessConstructor and Description
protected
public

Method Summary

Modifier and TypeMethod and Description
protected RawContainerHandle
findContainer(Transaction tran)

Open the container with this segmentId and containerId.

protected RawContainerHandle
findContainerForRedoRecovery(RawTransaction tran)

Subclass (e.g., ContainerOperation) that wishes to do something abou missing container in load tran should override this method to return the recreated container

public ByteArray
getPreparedLog()

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

the default for prepared log is always null for all the operations that don't have optionalData.

public int
group()

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

A space operation is a RAWSTORE log record

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

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

Determine if the operation should be reapplied in recovery redo.

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
releaseResource(Transaction tran)

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

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

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
containerIdback to summary
protected ContainerKey containerId
containerVersionback to summary
private long containerVersion
foundHereback to summary
private transient boolean foundHere

Constructor Detail

ContainerBasicOperationback to summary
protected ContainerBasicOperation(RawContainerHandle hdl) throws StandardException
ContainerBasicOperationback to summary
public ContainerBasicOperation()

Method Detail

findContainerback to summary
protected RawContainerHandle findContainer(Transaction tran) throws StandardException

Open the container with this segmentId and containerId. This method should only be called if the container has already been created.

Exceptions
StandardException:
the container cannot be found or cannot be opened.
findContainerForRedoRecoveryback to summary
protected RawContainerHandle findContainerForRedoRecovery(RawTransaction tran) throws StandardException

Subclass (e.g., ContainerOperation) that wishes to do something abou missing container in load tran should override this method to return the recreated container

Exceptions
StandardException:
Standard Derby error policy
getPreparedLogback to summary
public ByteArray getPreparedLog()

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

the default for prepared log is always null for all the operations that don't have optionalData. If an operation has optional data, the operation need to prepare the optional data for this method. Space Operation has no optional data to write out

groupback to summary
public int group()

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

A space operation is a RAWSTORE log record

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

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

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

Determine if the operation should be reapplied in recovery redo. If redo is needed, acquire any resource that is necessary for the loggable's doMe method. These need to be released in the releaseResource method.

The sequence of events in recovery redo of a Loggable operation is:

  • Get the loggable operation. If loggable.needsRedo is false, then no need to redo this operation.
  • If loggable.needsRedo is true, all the resources necessary for applying the doMe is acquired in needsRedo.
  • If the loggable is actually a compensation operation, then the logging system will find the undoable operation that needs to be undone, call compensation.setUndoOp with the undoable operation.
  • The recovery system then calls loggable.doMe, which re-applies the loggable operation, or re-applies the compensation operation
  • The recovery system then calls loggable.releaseResource.
Parameters
xact:Transaction

The transaction trying to redo this operation

Returns:boolean

true if operation needs redoing, false if not.

Exceptions
StandardException:
Standard Derby error 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.
releaseResourceback to summary
public void releaseResource(Transaction tran)

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.

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