|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An Undoable operation is an operation that changed the state of the RawStore in the context of a transaction and this change can be rolled back.
Transaction.logAndDo(org.apache.derby.iapi.store.raw.Loggable)
,
Compensation
Field Summary |
Fields inherited from interface org.apache.derby.iapi.store.raw.Loggable |
ABORT, BI_LOG, COMMIT, COMPENSATION, FILE_RESOURCE, FIRST, LAST, PREPARE, RAWSTORE, XA_NEEDLOCK |
Method Summary | |
Compensation |
generateUndo(Transaction xact,
LimitObjectInput in)
Generate a loggable which will undo this change, using the optional input if necessary. |
Methods inherited from interface org.apache.derby.iapi.store.raw.Loggable |
doMe, getPreparedLog, group, needsRedo, releaseResource |
Methods inherited from interface java.io.Externalizable |
readExternal, writeExternal |
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat |
getTypeFormatId |
Method Detail |
public Compensation generateUndo(Transaction xact, LimitObjectInput in) throws StandardException, java.io.IOException
NOTE
Any logical undo logic must be hidden behind generateUndo.
During recovery redo, it should not depend on any logical undo logic.
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.
If you do write your own generateUndo or needsRedo, any
resource you latch or acquire, you must release them in
Compensation.doMe() or in Compensation.releaseResource().
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.
xact
- the transaction doing the rollback
java.io.IOException
- Can be thrown by any of the methods of ObjectInput.
StandardException
- Standard Cloudscape policy.Loggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction)
,
Loggable.needsRedo(org.apache.derby.iapi.store.raw.Transaction)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |