Transaction#logAndDo
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | FIRST
Each loggable belongs to one or more groups of similar functionality. |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int |
| 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)Apply the change indicated by this operation and optional data. |
| public ByteArray | getPreparedLog()
The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray. |
| public int | |
| public boolean | Returns: true if operation needs redoing, false if not.The transaction trying to redo this operation xact)Determine if the operation should be reapplied in recovery redo. |
| public void | releaseResource(Transaction xact)
Release any resource that was acquired for doMe for rollback or recovery redo. |
| ABORT | back to summary |
|---|---|
| public static final int ABORT | |
| BI_LOG | back to summary |
|---|---|
| public static final int BI_LOG | |
| CHECKSUM | back to summary |
|---|---|
| public static final int CHECKSUM | |
| COMMIT | back to summary |
|---|---|
| public static final int COMMIT | |
| COMPENSATION | back to summary |
|---|---|
| public static final int COMPENSATION | |
| FILE_RESOURCE | back to summary |
|---|---|
| public static final int FILE_RESOURCE | |
| FIRST | back to summary |
|---|---|
| public static final int FIRST Each loggable belongs to one or more groups of similar functionality. Grouping is a way to quickly sort out log records that are interesting to different modules or different implementations. When a module makes loggable and sent it to the log file, it must mark this loggable with one or more of the following group. If none fit, or if the loggable encompasses functionality that is not described in existing groups, then a new group should be introduced. Grouping has no effect on how the record is logged or how it is treated in rollback or recovery. The following groups are defined. This list serves as the registry of all loggable groups. | |
| LAST | back to summary |
|---|---|
| public static final int LAST | |
| PREPARE | back to summary |
|---|---|
| public static final int PREPARE | |
| RAWSTORE | back to summary |
|---|---|
| public static final int RAWSTORE | |
| XA_NEEDLOCK | back to summary |
|---|---|
| public static final int XA_NEEDLOCK | |
| doMe | back to summary |
|---|---|
| public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException 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.
| |
| getPreparedLog | back to summary |
|---|---|
| public ByteArray getPreparedLog() throws StandardException The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray. The ByteArray can be prepared when the log operation is constructed, or it can be prepared when getPreparedLog() is called. Called by the log manager to allow the log operation to pass the buffer which contains optional data that will be available in to doMe() methods.
| |
| group | back to summary |
|---|---|
| public int group() Get the loggable's group value | |
| needsRedo | back to summary |
|---|---|
| public boolean needsRedo(Transaction xact) throws StandardException 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:
| |
| releaseResource | back to summary |
|---|---|
| public void releaseResource(Transaction xact) 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. | |