Class EncryptContainerOperation
- java.lang.Object
-
- org.apache.derby.impl.store.raw.data.EncryptContainerOperation
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,Formatable,TypedFormat,Loggable,Undoable
public class EncryptContainerOperation extends java.lang.Object implements Undoable
Log operation to encrypt a container with a new encryption key or to encrypt an unencrypted container while configuring the database for encryption. Container is synced to the disk when encryption is is successful, there is nothing to do on a redo. If there is crash/error while configuring a database for encryption; original version of the container is put back during undo.- See Also:
Undoable, Serialized Form
Format ID LOGOP_ENCRYPT_CONTAINER the formatId is written by FormatIdOutputStream when this object is written out by writeObject Purpose to record enctyption of container with a new encryption key. Upgrade Disk Layout containerId(ContainerKey) the id of the container this operation applies to
-
-
Field Summary
Fields Modifier and Type Field Description private ContainerKeycontainerId-
Fields inherited from interface org.apache.derby.iapi.store.raw.Loggable
ABORT, BI_LOG, CHECKSUM, COMMIT, COMPENSATION, FILE_RESOURCE, FIRST, LAST, PREPARE, RAWSTORE, XA_NEEDLOCK
-
-
Constructor Summary
Constructors Modifier Constructor Description EncryptContainerOperation()protectedEncryptContainerOperation(RawContainerHandle hdl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoMe(Transaction tran, LogInstant instant, LimitObjectInput in)Containers are not encryped on a redo.CompensationgenerateUndo(Transaction tran, LimitObjectInput in)Generate a Compensation (EncryptContainerUndoOperation) that will rollback the changes made to the container during container encryption.ByteArraygetPreparedLog()the default for prepared log is always null for all the operations that don't have optionalData.intgetTypeFormatId()Return my format identifier.intgroup()A space operation is a RAWSTORE log recordbooleanneedsRedo(Transaction xact)Check if this operation needs to be redone during recovery redo.voidreadExternal(java.io.ObjectInput in)voidreleaseResource(Transaction tran)Release any resource that was acquired for doMe for rollback or recovery redo.java.lang.StringtoString()debugvoidundoMe(Transaction tran)Undo of encrytpion of the container.voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
containerId
private ContainerKey containerId
-
-
Constructor Detail
-
EncryptContainerOperation
protected EncryptContainerOperation(RawContainerHandle hdl) throws StandardException
- Throws:
StandardException
-
EncryptContainerOperation
public EncryptContainerOperation()
-
-
Method Detail
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
getPreparedLog
public ByteArray getPreparedLog()
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. Encrypt Operation has no optional data to write out- Specified by:
getPreparedLogin interfaceLoggable
-
releaseResource
public void releaseResource(Transaction tran)
Description copied from interface:LoggableRelease 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.- Specified by:
releaseResourcein interfaceLoggable
-
group
public int group()
A space operation is a RAWSTORE log record
-
needsRedo
public boolean needsRedo(Transaction xact) throws StandardException
Check if this operation needs to be redone during recovery redo. Returns true if this op should be redone during recovery redo,- Specified by:
needsRedoin interfaceLoggable- Parameters:
xact- the transaction that is doing the rollback- Returns:
- true, if this operation needs to be redone during recovery.
- Throws:
StandardException- Standard Derby error policy- See Also:
Loggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction)
-
getTypeFormatId
public int getTypeFormatId()
Return my format identifier.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Returns:
- The identifier. (A UUID stuffed in an array of 16 bytes).
-
doMe
public final void doMe(Transaction tran, LogInstant instant, LimitObjectInput in) throws StandardException
Containers are not encryped on a redo. Nothing to do in this method.- Specified by:
doMein interfaceLoggable- Parameters:
tran- transaction doing the operation.instant- log instant for this operation.in- unused by this log operation.- Throws:
StandardException- Standard Derby error policy
-
undoMe
public void undoMe(Transaction tran) throws StandardException
Undo of encrytpion of the container. Original version of the container that existed before the start of the database encryption is put back.- Parameters:
tran- the transaction that is undoing this operation- Throws:
StandardException- Standard Derby error policy
-
generateUndo
public Compensation generateUndo(Transaction tran, LimitObjectInput in) throws StandardException
Generate a Compensation (EncryptContainerUndoOperation) that will rollback the changes made to the container during container encryption.- Specified by:
generateUndoin interfaceUndoable- Parameters:
tran- the transaction doing the compensatingin- optional input; not used by this operation.- Returns:
- the compensation operation that will rollback this change, or null if nothing to undo.
- Throws:
StandardException- Standard Derby error policy- See Also:
Loggable.releaseResource(org.apache.derby.iapi.store.raw.Transaction),Loggable.needsRedo(org.apache.derby.iapi.store.raw.Transaction)
-
toString
public java.lang.String toString()
debug- Overrides:
toStringin classjava.lang.Object
-
-