Transaction#logAndDo, Compensation
| Modifier and Type | Method and Description |
|---|---|
| public Compensation | Returns: the compensation operation that will rollback this change, or null if nothing to undo.the transaction doing the rollback xact, LimitObjectInput in)Generate a loggable which will undo this change, using the optional input if necessary. |
| generateUndo | back to summary |
|---|---|
| public Compensation generateUndo(Transaction xact, LimitObjectInput in) throws StandardException, IOException 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.
| |