java.io.Externalizable
, java.io.Serializable
, Formatable
, TypedFormat
, Loggable
, Undoable
public class RemoveFileOperation extends java.lang.Object implements Undoable
Modifier and Type | Field | Description |
---|---|---|
private StorageFile |
fileToGo |
|
private long |
generationId |
|
private java.lang.String |
name |
|
private boolean |
removeAtOnce |
ABORT, BI_LOG, CHECKSUM, COMMIT, COMPENSATION, FILE_RESOURCE, FIRST, LAST, PREPARE, RAWSTORE, XA_NEEDLOCK
Constructor | Description |
---|---|
RemoveFileOperation() |
|
RemoveFileOperation(java.lang.String name,
long generationId,
boolean removeAtOnce) |
Modifier and Type | Method | Description |
---|---|---|
void |
doMe(Transaction xact,
LogInstant instant,
LimitObjectInput in) |
Apply the change indicated by this operation and optional data.
|
Compensation |
generateUndo(Transaction xact,
LimitObjectInput in) |
Generate a loggable which will undo this change, using the optional
input if necessary.
|
ByteArray |
getPreparedLog() |
the default for prepared log is always null for all the operations
that don't have optionalData.
|
int |
getTypeFormatId() |
Return my format identifier.
|
int |
group() |
A space operation is a RAWSTORE log record
|
boolean |
needsRedo(Transaction xact) |
Determine if the operation should be reapplied in recovery redo.
|
void |
readExternal(java.io.ObjectInput in) |
|
void |
releaseResource(Transaction tran) |
Release any resource that was acquired for doMe for rollback or
recovery redo.
|
void |
writeExternal(java.io.ObjectOutput out) |
private java.lang.String name
private long generationId
private boolean removeAtOnce
private transient StorageFile fileToGo
public RemoveFileOperation()
RemoveFileOperation(java.lang.String name, long generationId, boolean removeAtOnce)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public int getTypeFormatId()
getTypeFormatId
in interface TypedFormat
public ByteArray getPreparedLog()
getPreparedLog
in interface Loggable
public void releaseResource(Transaction tran)
Loggable
releaseResource
in interface Loggable
public int group()
public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException
Loggable
The available() method of in indicates how much data can be read, i.e. how much was originally written.
doMe
in interface Loggable
xact
- the Transactioninstant
- the log instant of this operationin
- optional dataStandardException
- Standard Derby policy.public boolean needsRedo(Transaction xact) throws StandardException
Loggable
The sequence of events in recovery redo of a Loggable operation is:
needsRedo
in interface Loggable
xact
- The transaction trying to redo this operationStandardException
- Standard Derby error policyLoggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction)
public Compensation generateUndo(Transaction xact, LimitObjectInput in) throws StandardException, java.io.IOException
Undoable
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.
generateUndo
in interface Undoable
xact
- the transaction doing the rollbackStandardException
- Standard Derby policy.java.io.IOException
- Can be thrown by any of the methods of ObjectInput.Loggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction)
,
Loggable.needsRedo(org.apache.derby.iapi.store.raw.Transaction)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.