java.lang.Object
org.apache.derby.impl.store.raw.data.PageBasicOperation
org.apache.derby.impl.store.raw.data.LogicalPageOperation
org.apache.derby.impl.store.raw.data.InsertOperation
- All Implemented Interfaces:
- java.io.Externalizable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.store.raw.Loggable, org.apache.derby.iapi.store.raw.LogicalUndoable, org.apache.derby.iapi.store.raw.RePreparable, java.io.Serializable, org.apache.derby.iapi.services.io.TypedFormat, org.apache.derby.iapi.store.raw.Undoable
- public final class InsertOperation
- extends LogicalPageOperation
Represents an insert of a record onto a page.
| 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 |
InsertOperation()
|
InsertOperation(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
BasePage page,
int slot,
int recordId,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo,
byte insertFlag,
int startColumn,
boolean isLongColumn,
int realStartColumn,
org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream logBuffer,
int realSpaceOnPage,
int overflowThreshold)
|
|
Method Summary |
void |
doMe(org.apache.derby.iapi.store.raw.Transaction xact,
org.apache.derby.iapi.store.raw.log.LogInstant instant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
Apply the change indicated by this operation and optional data. |
int |
getNextStartColumn()
|
org.apache.derby.iapi.util.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. |
int |
getTypeFormatId()
Return my format identifier. |
void |
readExternal(java.io.ObjectInput in)
Read this in |
void |
restoreLoggedRow(java.lang.Object[] row,
org.apache.derby.iapi.services.io.LimitObjectInput in)
Restore the row stored in the optional data of the log record. |
void |
restoreMe(org.apache.derby.iapi.store.raw.Transaction xact,
BasePage undoPage,
org.apache.derby.iapi.store.raw.log.LogInstant CLRinstant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
restore the before image of the page |
java.lang.String |
toString()
DEBUG: Print self. |
void |
undoMe(org.apache.derby.iapi.store.raw.Transaction xact,
BasePage undoPage,
int undoRecordId,
org.apache.derby.iapi.store.raw.log.LogInstant CLRInstant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
Undo the insert by simply marking the just inserted record as deleted. |
void |
writeExternal(java.io.ObjectOutput out)
Write this out. |
private void |
writeOptionalDataToBuffer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream logBuffer,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
boolean isLongColumn,
int realStartColumn,
int realSpaceOnPage,
int overflowThreshold)
Writes out the row that is to be inserted as the optional data. |
doMeSlot
protected int doMeSlot
insertFlag
protected byte insertFlag
startColumn
protected transient int startColumn
- next column that need to be inserted.
preparedLog
protected transient org.apache.derby.iapi.util.ByteArray preparedLog
InsertOperation
public InsertOperation(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
BasePage page,
int slot,
int recordId,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo,
byte insertFlag,
int startColumn,
boolean isLongColumn,
int realStartColumn,
org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream logBuffer,
int realSpaceOnPage,
int overflowThreshold)
throws org.apache.derby.iapi.error.StandardException
InsertOperation
public InsertOperation()
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Write this out.
- Specified by:
writeExternal in interface java.io.Externalizable- Overrides:
writeExternal in class LogicalPageOperation
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Read this in
- Specified by:
readExternal in interface java.io.Externalizable- Overrides:
readExternal in class LogicalPageOperation
getTypeFormatId
public int getTypeFormatId()
- Return my format identifier.
doMe
public void doMe(org.apache.derby.iapi.store.raw.Transaction xact,
org.apache.derby.iapi.store.raw.log.LogInstant instant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Description copied from interface:
org.apache.derby.iapi.store.raw.Loggable
- 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!
This method cannot acquire any resource (like latching of a page)
since it is called underneath the logging system, ie., the log record has
already been written to the log stream.
The available() method of in indicates how much data can be read, i.e.
how much was originally written.
undoMe
public void undoMe(org.apache.derby.iapi.store.raw.Transaction xact,
BasePage undoPage,
int undoRecordId,
org.apache.derby.iapi.store.raw.log.LogInstant CLRInstant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Undo the insert by simply marking the just inserted record as deleted.
All logical undo logic has already been taken care of by generateUndo.
- Specified by:
undoMe in class LogicalPageOperation
restoreLoggedRow
public void restoreLoggedRow(java.lang.Object[] row,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Restore the row stored in the optional data of the log record.
restoreMe
public void restoreMe(org.apache.derby.iapi.store.raw.Transaction xact,
BasePage undoPage,
org.apache.derby.iapi.store.raw.log.LogInstant CLRinstant,
org.apache.derby.iapi.services.io.LimitObjectInput in)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- restore the before image of the page
- Specified by:
restoreMe in class PageBasicOperation
getPreparedLog
public org.apache.derby.iapi.util.ByteArray getPreparedLog()
- Description copied from interface:
org.apache.derby.iapi.store.raw.Loggable
- 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.
- Specified by:
getPreparedLog in interface org.apache.derby.iapi.store.raw.Loggable- Overrides:
getPreparedLog in class PageBasicOperation
getNextStartColumn
public int getNextStartColumn()
writeOptionalDataToBuffer
private void writeOptionalDataToBuffer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream logBuffer,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
boolean isLongColumn,
int realStartColumn,
int realSpaceOnPage,
int overflowThreshold)
throws org.apache.derby.iapi.error.StandardException,
java.io.IOException
- Writes out the row that is to be inserted as the optional data.
toString
public java.lang.String toString()
- DEBUG: Print self.
- Overrides:
toString in class PageBasicOperation