| Modifier and Type | Field and Description |
|---|---|
| private transient StorageFile | |
| private long | |
| private String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | doMe(Transaction
the Transaction xact, LogInstant the log instant of this operation instant, LimitObjectInput optional data in)Implements org. Apply the change indicated by this operation and optional data. |
| public Compensation | generateUndo(Transaction
the transaction doing the rollback xact, LimitObjectInput in)Implements org. Generate a loggable which will undo this change, using the optional input if necessary. |
| public ByteArray | getPreparedLog()
Implements org. the default for prepared log is always null for all the operations that don't have optionalData. |
| public int | getTypeFormatId()
Implements org. Return my format identifier. |
| public int | group()
Implements org. A space operation is a RAWSTORE log record |
| public boolean | needsRedo(Transaction
The transaction trying to redo this operation xact)Implements org. 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. 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. Release any resource that was acquired for doMe for rollback or recovery redo. |
| public void | writeExternal(ObjectOutput
the stream to write the object to out)Implements java. 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. |
| fileToGo | back to summary |
|---|---|
| private transient StorageFile fileToGo | |
| generationId | back to summary |
|---|---|
| private long generationId | |
| name | back to summary |
|---|---|
| private String name | |
| removeAtOnce | back to summary |
|---|---|
| private boolean removeAtOnce | |
| RemoveFileOperation | back to summary |
|---|---|
| public RemoveFileOperation() | |
| RemoveFileOperation | back to summary |
|---|---|
| pack-priv RemoveFileOperation(String name, long generationId, boolean removeAtOnce) | |
| doMe | back to summary |
|---|---|
| public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException Implements org. Doc from org. Apply the change indicated by this operation and optional data.
If this method fail, the system will be shut down because the log
record has already been written to disk. Moreover, the log record will
be replayed during recovery and this doMe method will be called on the
same page again, so if it fails again, recovery will fail and the
database cannot be started. So it is very important to make sure that
every resource you need, such as disk space, has been acquired before
the logAndDo method is called!
The available() method of in indicates how much data can be read, i.e. how much was originally written.
| |
| generateUndo | back to summary |
|---|---|
| public Compensation generateUndo(Transaction xact, LimitObjectInput in) throws StandardException, IOException Implements org. Doc from org. Generate a loggable which will undo this change, using the optional input if necessary. Note
There are 3 ways to implement a redo-only log record:
Any resource (e.g., latched page) that is needed for the
undoable.undoMe() must be acquired in undoable.generateUndo().
Moreover, that resource must be identified in the compensation
operation, and reacquired in the compensation.needsRedo() method during
recovery redo.
To write a generateUndo operation, find the object that needs to be rolled back. Assuming that it is a page, latch it, put together a Compensation operation with the undoOp set to this operation, and save the page number in the compensation operation, then return the Compensation operation to the logging system. The sequence of events in a rollback of a undoable operation is
The available() method of in indicates how much data can be read, i.e. how much was originally written.
| |
| getPreparedLog | back to summary |
|---|---|
| public ByteArray getPreparedLog() Implements org. 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 | |
| getTypeFormatId | back to summary |
|---|---|
| public int getTypeFormatId() Implements org. Return my format identifier.
| |
| group | back to summary |
|---|---|
| public int group() Implements org. A space operation is a RAWSTORE log record | |
| needsRedo | back to summary |
|---|---|
| public boolean needsRedo(Transaction xact) throws StandardException Implements org. Doc from org. 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:
| |
| readExternal | back to summary |
|---|---|
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException Implements java. Doc from java. 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.
| |
| releaseResource | back to summary |
|---|---|
| public void releaseResource(Transaction tran) Implements org. Doc from org. 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. | |
| writeExternal | back to summary |
|---|---|
| public void writeExternal(ObjectOutput out) throws IOException Implements java. Doc from java. 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.
| |