| java.lang.Object org.apache.derby.impl.store.raw.data.BasePage
All known Subclasses: org.apache.derby.impl.store.raw.data.CachedPage,
BasePage | abstract public class BasePage implements Page,Lockable,Observer,TypedFormat(Code) | | This class implements all the the generic locking behaviour for a Page.
It leaves method used to log and store the records up to sub-classes.
It is intended that the object can represent multiple pages from different
containers during its lifetime.
A page contains a set of records, which can be accessed by "slot",
which defines the order of the records on the page, or by "id" which
defines the identity of the records on the page. Clients access
records by both slot and id, depending on their needs.
BasePage implements Observer to watch the ContainerHandle which notifies
its Observers when it is closing.
MT - mutable
|
Constructor Summary | |
protected | BasePage() Create a new, empty page. |
Method Summary | |
final public static RecordHandle | MakeRecordHandle(PageKey pkey, int recordHandleConstant) | abstract public boolean | allowInsert() Returns false if an insert is not to be allowed in the page. | abstract public int | appendOverflowFieldHeader(DynamicByteArrayOutputStream logBuffer, RecordHandle overflowHandle) Append an overflow pointer to a partly logged row,
to point to a long column that just been logged. | final protected long | bumpPageVersion() increment the version by one and return the new version. | final protected void | bumpRecordCount(int number) | protected void | cleanPageForReuse() | public void | clearIdentity() | final protected void | clearLastLogInstant() | public void | compactRecord(RecordHandle handle) Try to compact this record. | abstract protected void | compactRecord(RawTransaction t, int slot, int recordId) Subclass implementation of compactRecord. | public void | copyAndPurge(Page destPage, int src_slot, int num_rows, int dest_slot) See Also: Page.copyAndPurge exception: StandardException - Standard exception policy. | public void | deallocatePage() | public boolean | delete(RecordHandle handle, LogicalUndo undo) See Also: Page.delete See Also: BasePage.deleteAtSlot exception: StandardException - Standard exception policy. | public RecordHandle | deleteAtSlot(int slot, boolean delete, LogicalUndo undo) See Also: Page.deleteAtSlot Parameters: slot - the slot number Parameters: delete - true if this record is to be deleted, false if thisdeleted record is to be marked undeleted Parameters: undo - logical undo logic if necessary exception: StandardException - Standard exception policy. | abstract public void | doUpdateAtSlot(RawTransaction t, int slot, int id, Object[] row, FormatableBitSet validColumns) | abstract public boolean | entireRecordOnPage(int slot) Returns true if the entire record of that slot fits inside of this
page. | public RecordHandle | fetch(RecordHandle handle, Object[] row, FormatableBitSet validColumns, boolean forUpdate)
- Lock the record (according to the locking policy)
- If the record is deleted then return null.
| final public RecordHandle | fetchFieldFromSlot(int slot, int fieldId, Object column) | public RecordHandle | fetchFromSlot(RecordHandle rh, int slot, Object[] row, FetchDescriptor fetchDesc, boolean ignoreDelete) | final public int | fetchNumFields(RecordHandle handle) See Also: Page.fetchNumFields exception: StandardException - Standard exception policy. | public int | fetchNumFieldsAtSlot(int slot) See Also: Page.fetchNumFieldsAtSlot exception: StandardException - Standard exception policy. | protected void | fillInIdentity(PageKey key) | public int | findRecordById(int recordId, int slotHint) Find the slot for the record with the passed in identifier.
This method returns the record regardless of its deleted status.
The "slotHint" argument is a hint about what slot the record id might
be in. | public AuxObject | getAuxObject() Get the aux object. | final public StoredRecordHeader | getHeaderAtSlot(int slot) | public Object | getIdentity() OK to hand object outside to cache.. | final public RecordHandle | getInvalidRecordHandle() | final public LogInstant | getLastLogInstant() | abstract protected BasePage | getNewOverflowPage() | final public int | getNextSlotNumber(RecordHandle handle) | abstract public BasePage | getOverflowPageForInsert(int slot, Object[] row, FormatableBitSet validColumns, int startColumn) | abstract protected byte[] | getPageArray() | public PageKey | getPageId() | final public long | getPageNumber() | public byte | getPageStatus() | final public long | getPageVersion() Return the current page version. | final public RecordHandle | getRecordHandle(int recordId) | final public RecordHandle | getRecordHandleAtSlot(int slot) | abstract public int | getRecordLength(int slot) Get the stored length of a record. | abstract public int | getReservedCount(int slot) Return the total number of bytes reserved by the
record at this slot. | final public int | getSlotNumber(RecordHandle handle) | abstract public int | getTotalSpace(int slot) Return the total number of bytes used, reserved, or wasted by the
record at this slot. | public void | initPage(int initFlag, long pageOffset) | abstract public void | initPage(LogInstant instant, byte status, int recordId, boolean overflow, boolean reuse) | protected void | initialize() Initialized the BasePage.
Initialize the object, ie. | protected void | initializeHeaders(int numRecords) Must be called by a sub-class before calling setHeaderAtSlot. | final public RecordHandle | insert(Object[] row, FormatableBitSet validColumns, byte insertFlag, int overflowThreshold) | public RecordHandle | insertAllowOverflow(int slot, Object[] row, FormatableBitSet validColumns, int startColumn, byte insertFlag, int overflowThreshold, RecordHandle nextPortionHandle) Insert a row allowing overflow. | public RecordHandle | insertAtSlot(int slot, Object[] row, FormatableBitSet validColumns, LogicalUndo undo, byte insertFlag, int overflowThreshold) | protected RecordHandle | insertLongColumn(BasePage mainChainPage, LongColumnException lce, byte insertFlag) When we update a column, it turned into a long column. | protected RecordHandle | insertNoOverflow(int slot, Object[] row, FormatableBitSet validColumns, LogicalUndo undo, byte insertFlag, int overflowThreshold) | abstract protected int | internalDeletedRecordCount() | protected int | internalNonDeletedRecordCount() | public boolean | isDeletedAtSlot(int slot) See Also: Page.isDeletedAtSlot exception: StandardException - Standard exception policy. | final protected boolean | isDeletedOnPage(int slot) | public boolean | isLatched() | abstract public boolean | isOverflowPage() Return true if the page is an overflow page, false if not. | public boolean | lockAttributes(int flag, Hashtable attributes) This lockable wants to participate in the Virtual Lock table. | public void | lockEvent(Latch lockInfo) Latch me. | public boolean | lockerAlwaysCompatible() Is another request compatible, no never. | abstract public void | logColumn(int slot, int fieldId, Object column, DynamicByteArrayOutputStream out, int overflowThreshold) Log a to be stored column. | abstract public void | logField(int slot, int fieldNumber, OutputStream out) Log a currently stored field. | abstract public int | logLongColumn(int slot, int recordId, Object column, DynamicByteArrayOutputStream out) Log a to be stored long column. | abstract public void | logRecord(int slot, int flag, int recordId, FormatableBitSet validColumns, OutputStream out, RecordHandle headRowHandle) Log a currently stored record to the output stream.
The logged version of the record must be readable by storeRecord.
MT - latched - page latch must be held
Parameters: slot - Slot number the record is stored in. Parameters: flag - LOG_RECORD_*, the reason for logging the record. Parameters: recordId - Record identifier of the record. Parameters: validColumns - which columns needs to be logged Parameters: out - Where to write the logged form. Parameters: headRowHandle - the recordHandle of the head row piece, usedfor post commit cleanup for update. | abstract public int | logRow(int slot, boolean forInsert, int recordId, Object[] row, FormatableBitSet validColumns, DynamicByteArrayOutputStream out, int startColumn, byte insertFlag, int realStartColumn, int realSpaceOnPage, int overflowThreshold) Log the row that will be stored at the given slot to the given OutputStream.
The logged form of the Row must be readable by storeRecord.
MT - latched - page latch must be held
Parameters: slot - Slot number the record will be stored in. Parameters: forInsert - True if the row is being logged for an insert,false for an update. Parameters: recordId - Record identifier of the record. Parameters: row - The row version of the record. Parameters: validColumns - FormatableBitSet of which columns in row are valid,null indicates all are valid Parameters: out - Where to write the logged form. Parameters: startColumn - The first column that is being logged in this row.This is used when logging portion of long rows. Parameters: insertFlag - To indicate whether the insert would allow overflow. Parameters: realStartColumn - This is used when a long column is detected.Portion of the row may already be logged and storedin the 'out' buffer. | final public RecordHandle | makeRecordHandle(int recordHandleConstant) | abstract public int | newRecordId() Create a new record identifier. | abstract protected int | newRecordId(int recordId) Create a new record identifier, the passed in one is the last one created.
Use this method to collect and reserve multiple recordIds in one
stroke. | abstract public int | newRecordIdAndBump() Create a new record identifier, and bump to next recordid. | public int | nonDeletedRecordCount() | abstract public void | preDirty() The page or its header is about to be modified. | public void | purgeAtSlot(int slot, int numpurges, boolean needDataLogged) Purge one or more rows on a non-overflow page.
See Also: Page.purgeAtSlot exception: StandardException - Standard exception policy. | abstract public void | purgeRecord(LogInstant instant, int slot, int recordId) Purge a record from the page. | abstract protected void | purgeRowPieces(RawTransaction t, int slot, RecordHandle headRowHandle, boolean needDataLogged) Purge all the overflow columns and overflow rows of the record at slot.
exception: StandardException - Standard exception policy. | final public int | recordCount() | final public boolean | recordExists(RecordHandle handle, boolean ignoreDelete) | abstract public StoredRecordHeader | recordHeaderOnDemand(int slot) | protected void | releaseExclusive() Release the exclusive latch on the page. | protected void | removeAndShiftDown(int slot) Remove record at slot.
Remove the slot at the in-memory slot table, i.e.,
slots from 0 to deleteSlot-1 is untouched, deleteSlot is removed from
in memory slot table, deleteSlot+1 .. | public boolean | requestCompatible(Object requestedQualifier, Object grantedQualifier) Is another request compatible, no never. | abstract public void | reserveSpaceForSlot(LogInstant instant, int slot, int spaceToReserve) Reserve the required number of bytes for the record in the specified slot. | abstract protected void | restorePortionLongColumn(OverflowInputStream fetchStream) Read portion of a log record at the given slot into the given byteHolder. | abstract protected boolean | restoreRecordFromSlot(int slot, Object[] row, FetchDescriptor fetchDesc, RecordHandle rh, StoredRecordHeader recordHeader, boolean isHeadRow) Read the record at the given slot into the given row.
This reads and initializes the columns in the row array from the raw
bytes stored in the page associated with the given slot. | abstract public void | restoreRecordFromStream(LimitObjectInput in, Object[] row) Restore a storable row from a InputStream that was used to
store the row after a logRecord call. | public void | setAuxObject(AuxObject obj) Set the aux object.
MT - single thread required. | abstract public void | setContainerRowCount(long count) Set the number of rows in the container - the page uses this to decide
whether it needs to aggressive set the container's row count when it
changes. | public int | setDeleteStatus(int slot, boolean delete) Mark the record at the passed in slot as deleted. | abstract public void | setDeleteStatus(LogInstant instant, int slot, boolean delete) Set the delete status of a record from the page. | public void | setExclusive(BaseContainerHandle requester) Get an exclusive latch on the page. | boolean | setExclusiveNoWait(BaseContainerHandle requester) Get an exclusive latch on the page, but only if I don't have to wait. | final protected void | setHeaderAtSlot(int slot, StoredRecordHeader rh) Must be called by any non-abstract sub-class to initialise the slot
table. | protected void | setPageStatus(byte status) Set page status based on passed in status flag. | abstract public void | setPageStatus(LogInstant instant, byte status) | final public void | setPageVersion(long v) set it when the page is read from disk. | abstract public void | setReservedSpace(LogInstant instant, int slot, int value) Set the reserved space for this row to value. | protected StoredRecordHeader | shiftUp(int low) Shift all records in the in-memory slot table up one slot,
starting at and including the record in slot 'low'
A new slot is added to accomdate the move. | public boolean | shouldReclaimSpace(int num_non_deleted_rows, int slot_just_deleted) Is this page/deleted row a candidate for immediate reclaim space.
Used by access methods after executing a delete on "slot_just_deleted"
to ask whether a post commit should be queued to try to reclaim space
after the delete commits. | abstract public void | skipField(ObjectInput in) Skip a previously stored field written by logField or logColumn. | abstract public void | skipRecord(ObjectInput in) | protected String | slotTableToString() | abstract public boolean | spaceForCopy(int num_rows, int[] spaceNeeded) Is there space for copying this many rows which takes this many bytes
on the page
MT - latched, page is latched when this methods is called. | abstract public void | storeField(LogInstant instant, int slot, int fieldId, ObjectInput in) Read a previously stored field written by logField or logColumn and store
it on the data page at thge given slot with the given record identifier
and field number. | abstract public void | storeRecord(LogInstant instant, int slot, boolean forInsert, ObjectInput in) Read a previously stored record written by logRecord or logRow and store
it on the data page at the given slot with the given record identifier. | abstract public boolean | unfilled() | public void | unlatch() Unlatch the page. | public void | unlockEvent(Latch lockInfo) Unlatch me, only to be called from lock manager. | final public boolean | update(RecordHandle handle, Object[] row, FormatableBitSet validColumns) | public void | update(Observable obj, Object arg) This object is set to observe the BaseContainerHandle it was obtained by,
that handle will notify its observers when it is being closed. | final public RecordHandle | updateAtSlot(int slot, Object[] row, FormatableBitSet validColumns) | public RecordHandle | updateFieldAtSlot(int slot, int fieldId, Object newValue, LogicalUndo undo) | abstract public void | updateFieldOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) | final protected void | updateLastLogInstant(LogInstant instant) | abstract public void | updateOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) |
INIT_PAGE_OVERFLOW | final public static int INIT_PAGE_OVERFLOW(Code) | | |
INIT_PAGE_REUSE | final public static int INIT_PAGE_REUSE(Code) | | Init page flag.
INIT_PAGE_REUSE - set if page is being initialized for reuse
INIT_PAGE_OVERFLOW - set if page will be an overflow page
INIT_PAGE_REUSE_RECORDID - set if page is being reused and its record
id can be reset to RecordHandle.FIRST_RECORD_ID, rather
to 1+ next recordId on the page
|
INIT_PAGE_REUSE_RECORDID | final public static int INIT_PAGE_REUSE_RECORDID(Code) | | |
INVALID_PAGE | final public static byte INVALID_PAGE(Code) | | |
LOG_RECORD_DEFAULT | final public static int LOG_RECORD_DEFAULT(Code) | | Log Record flag. Why the before image of this record is being logged
LOG_RECORD_FOR_UPDATE - set if the record is being logged for update.
LOG_RECORD_DEFAULT - for non update.
LOG_RECORD_FOR_PURGE - set if the record is being logged for purges
and no data required to ve logged.
The other cases (copy, purge, delete), we don't need to distinguish,
leave no bit set.
|
LOG_RECORD_FOR_PURGE | final public static int LOG_RECORD_FOR_PURGE(Code) | | |
LOG_RECORD_FOR_UPDATE | final public static int LOG_RECORD_FOR_UPDATE(Code) | | |
VALID_PAGE | final public static byte VALID_PAGE(Code) | | Values for pageStatus flag
page goes thru the following transition:
VALID_PAGE <-> deallocated page -> free page <-> VALID_PAGE
deallocated and free page are both INVALID_PAGE as far as BasePage is concerned.
When a page is deallocated, it transitioned from VALID to INVALID.
When a page is allocated, it trnasitioned from INVALID to VALID.
|
identity | protected PageKey identity(Code) | | this page's identity
MT - immutable - content dynamic : single thread required
|
inClean | protected boolean inClean(Code) | | |
owner | protected BaseContainerHandle owner(Code) | | Page owner during exclusive access.
MT - mutable : single thread required, provided by Lockable single thread required.
|
preLatch | protected boolean preLatch(Code) | | Used to determine latch state of a page.
MT - mutable
There are 3 latch states for a page:
UNLATCHED - (owner == null)
PRELATCH - (owner != null) && preLatch
LATCHED - (owner != null) && !preLatch
A page may be "cleaned" while it is either UNLATCHED, or PRELATCH, but
it must wait for it to be not LATCHED.
A page may move from UNLATCHED to PRELATCH, while being cleaned.
A page must wait for !inClean before it can move from PRELATCH to
LATCHED.
|
BasePage | protected BasePage()(Code) | | Create a new, empty page.
|
allowInsert | abstract public boolean allowInsert()(Code) | | Returns false if an insert is not to be allowed in the page.
|
appendOverflowFieldHeader | abstract public int appendOverflowFieldHeader(DynamicByteArrayOutputStream logBuffer, RecordHandle overflowHandle) throws StandardException, IOException(Code) | | Append an overflow pointer to a partly logged row,
to point to a long column that just been logged.
MT - latched - page latch must be held
Parameters: logBuffer - The buffer that contains the partially logged row. Parameters: overflowHandle - the overflow (continuation) pointerto the beginning of the long column exception: StandardException - Standard Cloudscape error policy |
bumpPageVersion | final protected long bumpPageVersion()(Code) | | increment the version by one and return the new version.
|
bumpRecordCount | final protected void bumpRecordCount(int number)(Code) | | |
cleanPageForReuse | protected void cleanPageForReuse()(Code) | | Initialized this page for reuse or first use
|
clearIdentity | public void clearIdentity()(Code) | | |
clearLastLogInstant | final protected void clearLastLogInstant()(Code) | | |
compactRecord | public void compactRecord(RecordHandle handle) throws StandardException(Code) | | Try to compact this record. Deleted record are treated the same way as
nondeleted record. This page must not be an overflow page. The record
may already have been purged from the page.
Locking Policy
No locks are obtained.
MT - latched
NOTE : CAVEAT
This operation will physically get rid of any reserved space this
record may have, or it may compact the record by merging strung out row
pieces together. Since the freed reserved space is immediately usable
by other transactions which latched the page, it is only safe to use
this operation if the caller knows that it has exclusive access to the
page for the duration of the transaction, i.e., effectively holding a
page lock on the page, AND that the record has no uncommitted
updates.
Parameters: handle - Handle to deleted or non-deleted record See Also: ContainerHandle.compactRecord exception: StandardException - Standard Cloudscape error policy |
deleteAtSlot | public RecordHandle deleteAtSlot(int slot, boolean delete, LogicalUndo undo) throws StandardException(Code) | | See Also: Page.deleteAtSlot Parameters: slot - the slot number Parameters: delete - true if this record is to be deleted, false if thisdeleted record is to be marked undeleted Parameters: undo - logical undo logic if necessary exception: StandardException - Standard exception policy. exception: StandardException - StandardException.newException(SQLState.UPDATE_DELETED_RECORDif an attempt to delete a record that is already deleted exception: StandardException - StandardException.newException(SQLState.UNDELETE_RECORDif an attempt to undelete a record that is not deleted |
entireRecordOnPage | abstract public boolean entireRecordOnPage(int slot) throws StandardException(Code) | | Returns true if the entire record of that slot fits inside of this
page. Returns false if part of the record on this slot overflows to
other pages, either due to long row or long column.
MT - latched
exception: StandardException - Standard Cloudscape error policy |
fetch | public RecordHandle fetch(RecordHandle handle, Object[] row, FormatableBitSet validColumns, boolean forUpdate) throws StandardException(Code) | |
- Lock the record (according to the locking policy)
- If the record is deleted then return null. We must check after we hold the lock to
ensure that we don't look at the delete status of an uncommitted record.
- Fetch the record
- Unlock the record (according to the locking policy)
See Also: Page.fetch exception: StandardException - messageId equals StandardException.newException(SQLState.RECORD_VANISHEDIf the record identfied by handle does not exist on this page. exception: StandardException - Standard Cloudscape error policy exception: StandardException - record is not on page with message id equal toStandardException.newException(SQLState.RECORD_VANISHED. |
findRecordById | public int findRecordById(int recordId, int slotHint)(Code) | | Find the slot for the record with the passed in identifier.
This method returns the record regardless of its deleted status.
The "slotHint" argument is a hint about what slot the record id might
be in. Callers may save the last slot where the record was across
latch/unlatches to the page, and then pass that slot back as a hint -
if the page has not shuffled slots since the last reference then the
hint will succeed and a linear search is saved. If the caller has
no idea where it may be, then FIRST_SLOT_NUMBER is passed in and a
linear search is performed.
MT - latched
Parameters: recordId - record id of the record to search for. Parameters: slotHint - "hint" about which slot the record might be in. |
getAuxObject | public AuxObject getAuxObject()(Code) | | Get the aux object.
MT - latched - It is required the caller throws away the returned reference
when the page is unlatched.
See Also: Page.getAuxObject |
getIdentity | public Object getIdentity()(Code) | | OK to hand object outside to cache..
|
getPageId | public PageKey getPageId()(Code) | | Get the Page identifer
MT - RESOLVE
|
getPageStatus | public byte getPageStatus()(Code) | | Get the page status, one of the values in the above page status flag
|
getPageVersion | final public long getPageVersion()(Code) | | Return the current page version.
|
getRecordLength | abstract public int getRecordLength(int slot) throws IOException(Code) | | Get the stored length of a record. This must match the amount of data
written by logColumn and logField.
MT - latched - page latch must be held
|
getReservedCount | abstract public int getReservedCount(int slot) throws IOException(Code) | | Return the total number of bytes reserved by the
record at this slot.
MT - latched, page is latched when this methods is called.
exception: IOException - Thrown by InputStream methods potential I/O errors |
getTotalSpace | abstract public int getTotalSpace(int slot) throws StandardException(Code) | | Return the total number of bytes used, reserved, or wasted by the
record at this slot.
MT - latched, page is latched when this methods is called.
exception: StandardException - Standard Cloudscape policy. |
initPage | public void initPage(int initFlag, long pageOffset) throws StandardException(Code) | | Mark this page as being allocated and initialize it to a pristine page
exception: StandardException - Cloudscape Standard error policy |
initPage | abstract public void initPage(LogInstant instant, byte status, int recordId, boolean overflow, boolean reuse) throws StandardException(Code) | | initialize a page for the first time or for reuse
All subtypes are expected to overwrite this method if it has something to clean up
exception: StandardException - Standard Cloudscape error policy |
initialize | protected void initialize()(Code) | | Initialized the BasePage.
Initialize the object, ie. perform work normally perfomed in
constructor. Called by setIdentity() and createIdentity().
|
initializeHeaders | protected void initializeHeaders(int numRecords)(Code) | | Must be called by a sub-class before calling setHeaderAtSlot.
|
insertAllowOverflow | public RecordHandle insertAllowOverflow(int slot, Object[] row, FormatableBitSet validColumns, int startColumn, byte insertFlag, int overflowThreshold, RecordHandle nextPortionHandle) throws StandardException(Code) | | Insert a row allowing overflow.
If handle is supplied then the record at that hanlde will be updated
to indicate it is a partial row and it has an overflow portion.
exception: StandardException - Standard Cloudscape error policy |
internalDeletedRecordCount | abstract protected int internalDeletedRecordCount()(Code) | | get record count without checking for latch
|
internalNonDeletedRecordCount | protected int internalNonDeletedRecordCount()(Code) | | get record count without checking for latch
|
isDeletedOnPage | final protected boolean isDeletedOnPage(int slot)(Code) | | |
isOverflowPage | abstract public boolean isOverflowPage()(Code) | | Return true if the page is an overflow page, false if not.
For implementation that don't have overflow pages, return false.
|
lockAttributes | public boolean lockAttributes(int flag, Hashtable attributes)(Code) | | This lockable wants to participate in the Virtual Lock table.
|
lockerAlwaysCompatible | public boolean lockerAlwaysCompatible()(Code) | | Is another request compatible, no never.
MT - single thread required (methods of Lockable)
See Also: Lockable.requestCompatible |
logColumn | abstract public void logColumn(int slot, int fieldId, Object column, DynamicByteArrayOutputStream out, int overflowThreshold) throws StandardException, IOException(Code) | | Log a to be stored column.
MT - latched - page latch must be held
Parameters: slot - slot of the current record Parameters: fieldId - field number of the column being updated Parameters: column - column version of the field. Parameters: out - Where to write the logged form. exception: StandardException - Standard Cloudscape error policy |
logField | abstract public void logField(int slot, int fieldNumber, OutputStream out) throws StandardException, IOException(Code) | | Log a currently stored field.
The logged version of the field must be readable by storeField.
MT - latched - page latch must be held
Parameters: slot - Slot number the record is stored in. Parameters: fieldNumber - Number of the field (starts at 0). Parameters: out - Where to write the logged form. exception: StandardException - Standard Cloudscape error policy |
logLongColumn | abstract public int logLongColumn(int slot, int recordId, Object column, DynamicByteArrayOutputStream out) throws StandardException, IOException(Code) | | Log a to be stored long column. return -1 when done.
MT - latched - page latch must be held
Parameters: slot - slot of the current record Parameters: recordId - the id of the long column record Parameters: column - column version of the field. Parameters: out - Where to write the logged form. exception: StandardException - Standard Cloudscape error policy |
logRecord | abstract public void logRecord(int slot, int flag, int recordId, FormatableBitSet validColumns, OutputStream out, RecordHandle headRowHandle) throws StandardException, IOException(Code) | | Log a currently stored record to the output stream.
The logged version of the record must be readable by storeRecord.
MT - latched - page latch must be held
Parameters: slot - Slot number the record is stored in. Parameters: flag - LOG_RECORD_*, the reason for logging the record. Parameters: recordId - Record identifier of the record. Parameters: validColumns - which columns needs to be logged Parameters: out - Where to write the logged form. Parameters: headRowHandle - the recordHandle of the head row piece, usedfor post commit cleanup for update. exception: StandardException - Standard Cloudscape error policy |
logRow | abstract public int logRow(int slot, boolean forInsert, int recordId, Object[] row, FormatableBitSet validColumns, DynamicByteArrayOutputStream out, int startColumn, byte insertFlag, int realStartColumn, int realSpaceOnPage, int overflowThreshold) throws StandardException, IOException(Code) | | Log the row that will be stored at the given slot to the given OutputStream.
The logged form of the Row must be readable by storeRecord.
MT - latched - page latch must be held
Parameters: slot - Slot number the record will be stored in. Parameters: forInsert - True if the row is being logged for an insert,false for an update. Parameters: recordId - Record identifier of the record. Parameters: row - The row version of the record. Parameters: validColumns - FormatableBitSet of which columns in row are valid,null indicates all are valid Parameters: out - Where to write the logged form. Parameters: startColumn - The first column that is being logged in this row.This is used when logging portion of long rows. Parameters: insertFlag - To indicate whether the insert would allow overflow. Parameters: realStartColumn - This is used when a long column is detected.Portion of the row may already be logged and storedin the 'out' buffer. After we log the long column,the saved buffer was passed here, and we need tocontinue to log the row. realStartColumn is the startingcolumn for the continuation of the logRow operation.Pass in (-1) if realStartColumn is not significant. Parameters: realSpaceOnPage - Being used in conjunction with realStartColumn,to indicate the real free space left on the page. exception: StandardException - Standard Cloudscape error policy |
newRecordId | abstract public int newRecordId() throws StandardException(Code) | | Create a new record identifier.
MT - latched, page is latched when this methods is called.
exception: StandardException - Standard Cloudscape error policy |
newRecordId | abstract protected int newRecordId(int recordId) throws StandardException(Code) | | Create a new record identifier, the passed in one is the last one created.
Use this method to collect and reserve multiple recordIds in one
stroke. Given the same input recordId, the subclass MUST return the
same recordId every time.
MT - latched, page is latched when this methods is called.
exception: StandardException - Standard Cloudscape error policy |
newRecordIdAndBump | abstract public int newRecordIdAndBump() throws StandardException(Code) | | Create a new record identifier, and bump to next recordid.
MT - latched, page is latched when this methods is called.
exception: StandardException - Standard Cloudscape error policy |
preDirty | abstract public void preDirty()(Code) | | The page or its header is about to be modified.
Loggable actions use this to make sure the page gets cleaned if a
checkpoint is taken after any log record is sent to the log stream but
before the page is actually dirtied.
|
purgeRecord | abstract public void purgeRecord(LogInstant instant, int slot, int recordId) throws StandardException, IOException(Code) | | Purge a record from the page.
MT - latched - page latch must be held
Parameters: slot - the slot to purge Parameters: recordId - the id of the record that is to be purged exception: StandardException - Standard Cloudscape error policy exception: IOException - Thrown by potential I/O errorswhile writing the page. |
releaseExclusive | protected void releaseExclusive()(Code) | | Release the exclusive latch on the page.
MT - latched
|
removeAndShiftDown | protected void removeAndShiftDown(int slot)(Code) | | Remove record at slot.
Remove the slot at the in-memory slot table, i.e.,
slots from 0 to deleteSlot-1 is untouched, deleteSlot is removed from
in memory slot table, deleteSlot+1 .. recordCount()-1 move to
down one slot.
MT - latched
|
requestCompatible | public boolean requestCompatible(Object requestedQualifier, Object grantedQualifier)(Code) | | Is another request compatible, no never.
MT - single thread required (methods of Lockable)
See Also: Lockable.requestCompatible |
reserveSpaceForSlot | abstract public void reserveSpaceForSlot(LogInstant instant, int slot, int spaceToReserve) throws StandardException, IOException(Code) | | Reserve the required number of bytes for the record in the specified slot.
MT - latched - page latch must be held
exception: StandardException - Standard Cloudscape error policy exception: IOException - Thrown by InputStream methods and potential I/O errorswhile writing the page. |
restoreRecordFromSlot | abstract protected boolean restoreRecordFromSlot(int slot, Object[] row, FetchDescriptor fetchDesc, RecordHandle rh, StoredRecordHeader recordHeader, boolean isHeadRow) throws StandardException(Code) | | Read the record at the given slot into the given row.
This reads and initializes the columns in the row array from the raw
bytes stored in the page associated with the given slot. If validColumns
is non-null then it will only read those columns indicated by the bit
set, otherwise it will try to read into every column in row[].
If there are more columns than entries in row[] then it just stops after
every entry in row[] is full.
If there are more entries in row[] than exist on disk, the requested
excess columns will be set to null by calling the column's object's
restoreToNull() routine
(ie. ((Object) column).restoreToNull() ).
If a qualifier list is provided then the row will only be read from
disk if all of the qualifiers evaluate true. Some of the columns may
have been read into row[] in the process of evaluating the qualifier.
MT - latched, page is latched when this methods is called.
Parameters: slot - the slot number Parameters: row - (out) filled in sparse row Parameters: fetchDesc - A set of information about the fetch: whatcolumns to fetch, any qualifiers, ... Parameters: rh - the record handle for the row at top level,and is used in OverflowInputStream to lock the row for Blobs/Clobs. Parameters: isHeadRow - Is the head row portion of the row, false ifa long row and the 2-N'th portion of the longrow. false if a qualifier_list is provided and the row does not qualifier (no row read in that case), else true. exception: StandardException - Standard Cloudscape error policy |
setAuxObject | public void setAuxObject(AuxObject obj)(Code) | | Set the aux object.
MT - single thread required. Calls via the Page interface will have the
page latched, thus providing single threadedness. Otherwise calls via this class
are only made when the class has no-identity, thus only a single thread can see the object.
See Also: Page.setAuxObject |
setContainerRowCount | abstract public void setContainerRowCount(long count)(Code) | | Set the number of rows in the container - the page uses this to decide
whether it needs to aggressive set the container's row count when it
changes.
|
setDeleteStatus | public int setDeleteStatus(int slot, boolean delete) throws StandardException, IOException(Code) | | Mark the record at the passed in slot as deleted.
return code comes from StoredRecordHeader class:
return 1, if delete status from not deleted to deleted
return -1, if delete status from deleted to not deleted
return 0, if status unchanged.
Any sub-class must call this method when deleting a record.
MT - latched
exception: StandardException - Standard Cloudscape error policy exception: IOException - IO error accessing page |
setDeleteStatus | abstract public void setDeleteStatus(LogInstant instant, int slot, boolean delete) throws StandardException, IOException(Code) | | Set the delete status of a record from the page.
MT - latched - page latch must be held
Parameters: slot - the slot to delete or undelete Parameters: delete - set delete status to this value exception: StandardException - Standard Cloudscape error policy exception: IOException - IO error accessing page |
setHeaderAtSlot | final protected void setHeaderAtSlot(int slot, StoredRecordHeader rh)(Code) | | Must be called by any non-abstract sub-class to initialise the slot
table.
|
setPageStatus | protected void setPageStatus(byte status)(Code) | | Set page status based on passed in status flag.
|
setPageStatus | abstract public void setPageStatus(LogInstant instant, byte status) throws StandardException(Code) | | Set the page status underneath a log record
MT - latched - page latch must be held
Parameters: instant - the log instant of the log record Parameters: status - the page status exception: StandardException - Standard Cloudscape error policy |
setPageVersion | final public void setPageVersion(long v)(Code) | | set it when the page is read from disk.
MT - single thread required - Only called while the page has no identity which
requires that only a single caller can be accessing it.
|
shiftUp | protected StoredRecordHeader shiftUp(int low)(Code) | | Shift all records in the in-memory slot table up one slot,
starting at and including the record in slot 'low'
A new slot is added to accomdate the move.
MT - latched
|
shouldReclaimSpace | public boolean shouldReclaimSpace(int num_non_deleted_rows, int slot_just_deleted) throws StandardException(Code) | | Is this page/deleted row a candidate for immediate reclaim space.
Used by access methods after executing a delete on "slot_just_deleted"
to ask whether a post commit should be queued to try to reclaim space
after the delete commits.
Will return true if the number of non-deleted rows on the page is
<= "num_non_deleted_rows". For instance 0 means schedule reclaim
only if all rows are deleted, 1 if all rows but one are deleted.
Will return true if the row just deleted is either a long row or long
column. In this case doing a reclaim space on the single row may
reclaim multiple pages of free space, so better to do it now rather
than wait for all rows on page to be deleted. This case is to address
the worst case scenario of all rows with long columns, but very short
rows otherwise. In this case there could be 1000's of rows on the
main page with many gigabytes of data on overflow pages in deleted space
that would not be reclaimed until all rows on the page were deleted.
true if a reclaim space should be scheduled post commit on thispage, false otherwise. Parameters: num_non_deleted_rows - threshold number of non-deleted rows toschedule reclaim space. Parameters: slot_just_deleted - row on page to check for long row/long column exception: StandardException - Standard exception policy. |
slotTableToString | protected String slotTableToString()(Code) | | Debugging, print slot table information
|
spaceForCopy | abstract public boolean spaceForCopy(int num_rows, int[] spaceNeeded) throws StandardException(Code) | | Is there space for copying this many rows which takes this many bytes
on the page
MT - latched, page is latched when this methods is called.
exception: StandardException - Standard Cloudscape policy. |
storeField | abstract public void storeField(LogInstant instant, int slot, int fieldId, ObjectInput in) throws StandardException, IOException(Code) | | Read a previously stored field written by logField or logColumn and store
it on the data page at thge given slot with the given record identifier
and field number. Any previously stored field is replaced.
MT - latched - page latch must be held
exception: StandardException - Standard Cloudscape error policy exception: IOException - Thrown by InputStream methods and potential I/O errorswhile writing the page. |
storeRecord | abstract public void storeRecord(LogInstant instant, int slot, boolean forInsert, ObjectInput in) throws StandardException, IOException(Code) | | Read a previously stored record written by logRecord or logRow and store
it on the data page at the given slot with the given record identifier.
Any previously stored record must be replaced.
MT - latched - page latch must be held
exception: StandardException - Standard Cloudscape error policy exception: IOException - Thrown by InputStream methods potential I/O errorswhile writing the page |
unfilled | abstract public boolean unfilled()(Code) | | Returns true if an insert is allowed in the page and the page is
relatively unfilled - let specific implementation decide what
relatively unfilled means
|
unlockEvent | public void unlockEvent(Latch lockInfo)(Code) | | Unlatch me, only to be called from lock manager.
MT - single thread required (methods of Lockable)
See Also: Lockable.requestCompatible |
update | public void update(Observable obj, Object arg)(Code) | | This object is set to observe the BaseContainerHandle it was obtained by,
that handle will notify its observers when it is being closed. In that case
we will release the latch on the page held by that container.
MT - latched
See Also: Observer.update |
updateFieldOverflowDetails | abstract public void updateFieldOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) throws StandardException(Code) | | Update the overflow pointer for a long column
MT - latched - page latch must be held
Parameters: handle - handle of the record for long row Parameters: overflowHandle - the overflow (continuation) pointer for the long row exception: StandardException - Standard Cloudscape error policy |
updateLastLogInstant | final protected void updateLastLogInstant(LogInstant instant)(Code) | | |
updateOverflowDetails | abstract public void updateOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) throws StandardException(Code) | | Update the overflow pointer for a long row
MT - latched - page latch must be held
Parameters: handle - handle of the record for long row Parameters: overflowHandle - the overflow (continuation) pointer for the long row exception: StandardException - Standard Cloudscape error policy |
|
|