|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> store >> [ raw overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.iapi.store.raw
Interface Page

- public interface Page
A Page contains an ordered set of records which are the stored form of rows. A record is a stream of bytes created from a row array. The record contains one or more fields, fields have a one to one correlation with the DataValueDescriptor's contained within a row array.
A Page represents exclusive access to a data page within a container. Exclusive access is released by calling the unlatch() method, once that occurs the caller must no longer use the Page reference.
Several of the methods in Page take a RecordHandle as an argument. RecordHandles are obtained from a Page, while holding exclusive access of Page or a from a previous exclusive access of a Page representing the same data page. All RecordHandle's used as arguments to methods (with the exception of recordExists()) must be valid for the current state of the page. If they are not valid then the method will throw an exception. A caller can ensure that a record handle is valid by:
- Obtaining the handle during this exclusive access of this page
- Checking the record still exists with the method recordExists()
- Not using a handle after a delete().
Several of the methods in Page take a slot number as an argument. A slot
always correspond to a record, which may be deleted or undeleted.
MT - Latched - In general every method requires the page to be latched.
Latching
All page methods which are not valid for a latched page throw an exception if the page is not latched. [@exception clauses on all the methods should be updated to reflect this].
Aux Objects
The page cache will manage a client object along with the page as long
as it remains in cache. This object is called the "aux object". The
aux object is associated with the page with setAuxObject(), and can be
retreived later with getAuxObject(). The aux object will remain valid
as long as the page is latched, but callers cannot assume that an aux
object will ever stick around once the page is unlatched. However, the
page manager promises to call pageBeingEvicted() once before clearing
the aux reference from the page.
| Field Summary | |
static java.lang.String |
DIAG_BYTES_FREE
|
static java.lang.String |
DIAG_BYTES_RESERVED
|
static java.lang.String |
DIAG_MAXROWSIZE
|
static java.lang.String |
DIAG_MINIMUM_REC_SIZE
|
static java.lang.String |
DIAG_MINROWSIZE
|
static java.lang.String |
DIAG_NUMOVERFLOWED
|
static java.lang.String |
DIAG_PAGE_SIZE
|
static java.lang.String |
DIAG_PAGEOVERHEAD
|
static java.lang.String |
DIAG_RESERVED_SPACE
|
static java.lang.String |
DIAG_ROWSIZE
|
static java.lang.String |
DIAG_SLOTTABLE_SIZE
|
static int |
FIRST_SLOT_NUMBER
The slot number of the first slot. |
static byte |
INSERT_CONDITIONAL
|
static byte |
INSERT_DEFAULT
|
static byte |
INSERT_FOR_SPLIT
|
static byte |
INSERT_INITIAL
Values for insertFlag. |
static byte |
INSERT_OVERFLOW
|
static byte |
INSERT_UNDO_WITH_PURGE
|
static int |
INVALID_SLOT_NUMBER
A slot number guaranteed to be invalid. |
| Method Summary | |
void |
copyAndPurge(Page destPage,
int src_slot,
int num_rows,
int dest_slot)
move rows from one page to another, purging in the process. |
PageTimeStamp |
currentTimeStamp()
Return a time stamp that can be used to identify the page of this specific instance. |
boolean |
delete(RecordHandle handle,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo)
Mark the record identified by position as deleted. |
RecordHandle |
deleteAtSlot(int slot,
boolean delete,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo)
Mark the record at slot as deleted or undeleted according to delete flag. |
boolean |
equalTimeStamp(PageTimeStamp ts)
See if timeStamp for this page is the same as the current instance of the page. |
RecordHandle |
fetch(RecordHandle handle,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
boolean forUpdate)
Fetch and lock a non-deleted record. |
RecordHandle |
fetchFieldFromSlot(int slot,
int fieldId,
java.lang.Object column)
Fetch a single field from a deleted or non-deleted record. |
RecordHandle |
fetchFromSlot(RecordHandle rh,
int slot,
java.lang.Object[] row,
FetchDescriptor fetchDesc,
boolean ignoreDelete)
Fetch a record located in the passed in slot. |
int |
fetchNumFields(RecordHandle handle)
Fetch the number of fields in a record. |
int |
fetchNumFieldsAtSlot(int slot)
Fetch the number of fields in a record. |
AuxObject |
getAuxObject()
Retrieve this page's aux object, returning null if there isn't one. |
RecordHandle |
getInvalidRecordHandle()
Return an invalid record handle. |
int |
getNextSlotNumber(RecordHandle handle)
Find slot for record with an id greater than the passed in identifier. |
long |
getPageNumber()
Return the page number of this page. |
RecordHandle |
getRecordHandle(int recordId)
Get a record handle from a previously stored record id. |
RecordHandle |
getRecordHandleAtSlot(int slot)
Get the record handle of row at slot. |
int |
getSlotNumber(RecordHandle handle)
Get the slot number. |
RecordHandle |
insert(java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
byte insertFlag,
int overflowThreshold)
Insert a record anywhere on the page. |
RecordHandle |
insertAtSlot(int slot,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo,
byte insertFlag,
int overflowThreshold)
Insert a record at the specified slot. |
boolean |
isDeletedAtSlot(int slot)
Test if a record is deleted. |
boolean |
isLatched()
|
RecordHandle |
makeRecordHandle(int recordHandleConstant)
Return a record handle for the given constant record id. |
int |
moveRecordForCompressAtSlot(int slot,
java.lang.Object[] row,
RecordHandle[] old_handle,
RecordHandle[] new_handle)
Move record to a page toward the beginning of the file. |
int |
nonDeletedRecordCount()
Return the number of records on this page that are not marked as deleted. |
void |
purgeAtSlot(int slot,
int numpurges,
boolean needDataLogged)
Purge the row(s) from page. |
int |
recordCount()
Return the number of records on the page. |
boolean |
recordExists(RecordHandle handle,
boolean ignoreDelete)
does the record still exist on the page? |
void |
setAuxObject(AuxObject aux)
Set the aux object for this page. |
void |
setTimeStamp(PageTimeStamp ts)
Set the time stamp to what is on page at this instance. |
boolean |
spaceForInsert()
Is it likely that an insert will fit on this page? |
boolean |
spaceForInsert(java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns,
int overflowThreshold)
will insert of this row fit on this page? |
void |
unlatch()
Unlatch me, the page is exclusivly latched by its current user until this method call is made. |
boolean |
update(RecordHandle handle,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns)
Update the record identified by the record handle. |
RecordHandle |
updateAtSlot(int slot,
java.lang.Object[] row,
org.apache.derby.iapi.services.io.FormatableBitSet validColumns)
Update the complete record identified by the slot. |
RecordHandle |
updateFieldAtSlot(int slot,
int fieldId,
java.lang.Object newValue,
org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo)
Update a field within the record, replacing its current value with the stored representation of newValue. |
| Field Detail |
FIRST_SLOT_NUMBER
public static final int FIRST_SLOT_NUMBER
- The slot number of the first slot. This is guaranteed to be zero.
- See Also:
- Constant Field Values
INVALID_SLOT_NUMBER
public static final int INVALID_SLOT_NUMBER
- A slot number guaranteed to be invalid.
- See Also:
- Constant Field Values
INSERT_INITIAL
public static final byte INSERT_INITIAL
- Values for insertFlag.
INSERT_INITIAL - flag initializer INSERT_DEFAULT - default insert behavior, if the record does not fit on the page where the insert operation is called, an error will be returned, instead of overflowing the record. INSERT_UNDO_WITH_PURGE - if this is set, then the undo of this insert will purge the row rather than mark it as deleted, which is the default behaviro for insertAtSlot and insert. INSERT_CONDITIONAL - if this flag is set, then, the overflow is conditional. The record will be overflowed only if it exceeds the threshold specified by the properties, or the parameter. INSERT_OVERFLOW - if this flag is set, then the insert operation will overflow the record if it does not fit on the page. INSERT_FOR_SPLIT - a record is being updated that causes new portions to be inserted *and* the last new portion needs to point to an existing portion. Rules for the insert flags: 1. If INSERT_DEFAULT is set, INSERT_CONDITIONAL and INSERT_OVERFLOW will be ignored 2. INSERT_UNDO_WITH_PURGE can be set with any of the other 3 flags. 3. If INSERT_OVERFLOW is not set, INSERT_CONDITIONAL will be ignored. But, it is not necessary to set INSERT_CONDITIONAL when setting INSERT_OVERFLOW. 4. If INSERT_DEFAULT, INSERT_OVERFLOW both are not set, then, default insert action will be taken, i.e. no overflow will be allowed.
- See Also:
- Constant Field Values
INSERT_DEFAULT
public static final byte INSERT_DEFAULT
- See Also:
- Constant Field Values
INSERT_UNDO_WITH_PURGE
public static final byte INSERT_UNDO_WITH_PURGE
- See Also:
- Constant Field Values
INSERT_CONDITIONAL
public static final byte INSERT_CONDITIONAL
- See Also:
- Constant Field Values
INSERT_OVERFLOW
public static final byte INSERT_OVERFLOW
- See Also:
- Constant Field Values
INSERT_FOR_SPLIT
public static final byte INSERT_FOR_SPLIT
- See Also:
- Constant Field Values
DIAG_PAGE_SIZE
public static final java.lang.String DIAG_PAGE_SIZE
- See Also:
- Constant Field Values
DIAG_RESERVED_SPACE
public static final java.lang.String DIAG_RESERVED_SPACE
- See Also:
- Constant Field Values
DIAG_MINIMUM_REC_SIZE
public static final java.lang.String DIAG_MINIMUM_REC_SIZE
- See Also:
- Constant Field Values
DIAG_BYTES_FREE
public static final java.lang.String DIAG_BYTES_FREE
- See Also:
- Constant Field Values
DIAG_BYTES_RESERVED
public static final java.lang.String DIAG_BYTES_RESERVED
- See Also:
- Constant Field Values
DIAG_NUMOVERFLOWED
public static final java.lang.String DIAG_NUMOVERFLOWED
- See Also:
- Constant Field Values
DIAG_ROWSIZE
public static final java.lang.String DIAG_ROWSIZE
- See Also:
- Constant Field Values
DIAG_MINROWSIZE
public static final java.lang.String DIAG_MINROWSIZE
- See Also:
- Constant Field Values
DIAG_MAXROWSIZE
public static final java.lang.String DIAG_MAXROWSIZE
- See Also:
- Constant Field Values
DIAG_PAGEOVERHEAD
public static final java.lang.String DIAG_PAGEOVERHEAD
- See Also:
- Constant Field Values
DIAG_SLOTTABLE_SIZE
public static final java.lang.String DIAG_SLOTTABLE_SIZE
- See Also:
- Constant Field Values
| Method Detail |
getPageNumber
public long getPageNumber()
- Return the page number of this page.
Page numbers are unique within a container and start at ContainerHandle.FIRST_PAGE_NUMBER and increment by 1 regardless of the page size.
MT - Latched
getInvalidRecordHandle
public RecordHandle getInvalidRecordHandle()
- Return an invalid record handle.
makeRecordHandle
public RecordHandle makeRecordHandle(int recordHandleConstant) throws org.apache.derby.iapi.error.StandardException
- Return a record handle for the given constant record id.
Return a record handle that doesn't represent a record but rather has a special meaning. Used for special cases like creating a key specific to the page, but not specific to a row on the page.
See RecordHandle interface for a list of "special record handles."
getRecordHandle
public RecordHandle getRecordHandle(int recordId)
- Get a record handle from a previously stored record id.
Get a record handle from a previously stored record identifier that was obtained from a RecordHandle.
MT - Latched
recordExists
public boolean recordExists(RecordHandle handle, boolean ignoreDelete) throws org.apache.derby.iapi.error.StandardException
- does the record still exist on the page?
If "ignoreDelete" is true and the record handle represents a record on the page (either marked deleted or not) return true. If "ignoreDelete" is false return true if the record handle represents a record on the page and the record is not marked as deleted. Return false otherwise.
MT - Latched
fetch
public RecordHandle fetch(RecordHandle handle, java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns, boolean forUpdate) throws org.apache.derby.iapi.error.StandardException
- Fetch and lock a non-deleted record.
Lock and fetch a non-deleted record identified by a RecordHandle. Reads data from the page into row.
Locking Policy
Calls the lockRecordForRead() method of the LockingPolicy object passed to the openContainer() call before the record is accessed.
The page latch may be released and re-latched within this method. This will occur if the record lock has to be waited for.
spaceForInsert
public boolean spaceForInsert()
throws org.apache.derby.iapi.error.StandardException
- Is it likely that an insert will fit on this page?
Return true if there is a good chance an insert will fit on this page, false otherwise. If this returns true then an insert may still fail by throwing an exception or by returning null, see insertAtSlot for details. It is very probable that this call is much faster than the version that takes a row. In situations where it is expected that the majority of times a row will fit on a page this method should be used and the null return handled from insert/insertAtSlot.
MT - latched
spaceForInsert
public boolean spaceForInsert(java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns, int overflowThreshold) throws org.apache.derby.iapi.error.StandardException
- will insert of this row fit on this page?
Return true if this record is guaranteed to be inserted successfully using insert() or insertAtSlot(). This guarantee is only valid if the following conditions are fulfilled before an insert is called with t his row.
- The page is not unlatched
- The page is not modified in any way, ie. no updates or other inserts
- The row is not modified in such a way that would change its storage size
MT - latched
insert
public RecordHandle insert(java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns, byte insertFlag, int overflowThreshold) throws org.apache.derby.iapi.error.StandardException
- Insert a record anywhere on the page.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is inserted.
MT - latched
update
public boolean update(RecordHandle handle, java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns) throws org.apache.derby.iapi.error.StandardException
- Update the record identified by the record handle.
Update the record, the new column values are found in row[] and if validColumns is not-null, only use the columns indicated as valid in the bit set.
The page latch may be released and re-latched within this method. This will occur if the record lock has to be waited for.
delete
public boolean delete(RecordHandle handle, org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo) throws org.apache.derby.iapi.error.StandardException
- Mark the record identified by position as deleted.
Mark the record identified by position as deleted. The record may be undeleted sometime later using undelete() by any transaction that sees the record.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is deleted.
The page latch may be released and re-latched within this method. This will occur if the record lock has to be waited for.
moveRecordForCompressAtSlot
public int moveRecordForCompressAtSlot(int slot,
java.lang.Object[] row,
RecordHandle[] old_handle,
RecordHandle[] new_handle)
throws org.apache.derby.iapi.error.StandardException
- Move record to a page toward the beginning of the file.
As part of compressing the table records need to be moved from the end of the file toward the beginning of the file. Only the contiguous set of free pages at the very end of the file can be given back to the OS. This call is used to purge the row from the current page, insert it into a previous page, and return the new row location Mark the record identified by position as deleted. The record may be undeleted sometime later using undelete() by any transaction that sees the record.
The interface is optimized to work on a number of rows at a time, optimally processing all rows on the page at once. The call will process either all rows on the page, or the number of slots in the input arrays - whichever is smaller. Locking Policy
MUST be called with table locked, not locks are requested. Because it is called with table locks the call will go ahead and purge any row which is marked deleted. It will also use purge rather than delete to remove the old row after it moves it to a new page. This is ok since the table lock insures that no other transaction will use space on the table before this transaction commits.
A page latch on the new page will be requested and released.
fetchNumFields
public int fetchNumFields(RecordHandle handle) throws org.apache.derby.iapi.error.StandardException
- Fetch the number of fields in a record.
Locking Policy
No locks are obtained.
MT - latched
getSlotNumber
public int getSlotNumber(RecordHandle handle) throws org.apache.derby.iapi.error.StandardException
- Get the slot number.
Get the slot number of a record on a latched page using its record handle.
Note The slot number is only good for as long as the page is latched.
MT - latched
getRecordHandleAtSlot
public RecordHandle getRecordHandleAtSlot(int slot) throws org.apache.derby.iapi.error.StandardException
- Get the record handle of row at slot.
Get the record handle of a record on a latched page using its slot number.
MT - latched
getNextSlotNumber
public int getNextSlotNumber(RecordHandle handle) throws org.apache.derby.iapi.error.StandardException
- Find slot for record with an id greater than the passed in identifier.
Find the slot for the first record on the page with an id greater than the passed in identifier.
Returns the slot of the first record on the page with an id greater than the one passed in. Usefulness of this functionality depends on the client's use of the raw store interfaces. If all "new" records are always inserted at the end of the page, and the raw store continues to guarantee that all record id's will be allocated in increasing order on a given page (assuming a PAGE_REUSABLE_RECORD_ID container), then a page is always sorted in record id order. For instance current heap tables function this way. If the client ever inserts at a particular slot number, rather than at the "end" then the record id's will not be sorted.
In the case where all record id's are always sorted on a page, then this routine can be used by scan's which "lose" their position because the row they have as a position was purged. They can reposition their scan at the "next" row after the row that is now missing from the table.
This method returns the record regardless of its deleted status.
MT - latched
insertAtSlot
public RecordHandle insertAtSlot(int slot, java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns, org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo, byte insertFlag, int overflowThreshold) throws org.apache.derby.iapi.error.StandardException
- Insert a record at the specified slot.
All records that occupy FIRST_SLOT_NUMBER to (slot - 1) are not moved.
All records that occupy slot to (recordCount() - 1) are moved up one slot.
The new record is inserted at the specified slot.
If slot == FIRST_SLOT_NUMBER, then the new record will be inserted at the first slot.
If slot == recordCount(), then the record is inserted in a new slot, no records are moved.
If slot is > recordCount() or if slot < FIRST_SLOT_NUMBER, an exception will be thrown.Space Policy
If the row will not fit on a page then:- an exception is thrown if the page has no other rows, this is an indication that the row could never fit on a page in this container.
- null is returned if there are other rows on the page, this is an indication that the row can potentially be inserted successfully onto an empty page.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is inserted.
MT - latched
fetchFromSlot
public RecordHandle fetchFromSlot(RecordHandle rh, int slot, java.lang.Object[] row, FetchDescriptor fetchDesc, boolean ignoreDelete) throws org.apache.derby.iapi.error.StandardException
- Fetch a record located in the passed in slot.
Fetch a record located in the passed in slot and fill-in the passed in StorebleRow and the Object columns contained within. If row is null then the record is locked but is not fetched.
This interface allows the caller to either return a deleted row or not. If "ignoreDelete" is set to true, fetch the record regardless of whether it is deleted or not (same as above fetchFromSlot). However, if "ignoreDelete" is set to false and the and the slot correspond to a deleted row, null is returned.
If a non-null Qualifier list is provided then the qualifier array will be applied to the row and the row will only be returned if the row qualifies, otherwise null will be returned. Values in the columns of row may or may not be altered while trying to apply the qualifiers, if null is returned the state of the columns is undefined. If a null Qualifier list is provided then no qualification is applied.
If a non-null record handle is passed in, it is assumed that the record handle corresponds to the record in the slot. If record handle is null, a record handle will be manufactured and returned if the record is not deleted or if "ignoreDelete" is true. This parameter is here for the case where the caller have already manufactured the record handle for locking or other purposes so it would make sense for the page to avoid creating a new record handle object if possible.
fetchFieldFromSlot
public RecordHandle fetchFieldFromSlot(int slot, int fieldId, java.lang.Object column) throws org.apache.derby.iapi.error.StandardException
- Fetch a single field from a deleted or non-deleted record.
Fills in the passed in Object column with the field
identified by fieldid if column is not null, otherwise the record
is locked but not fetched.
The fieldId of the first field is 0. If the fieldId is >= the number of fields on the record, column is restored to nullLocking Policy
No locks are obtained. It is up to the caller to obtain the correct locks.
It is guaranteed that the page latch is not released by this method
isDeletedAtSlot
public boolean isDeletedAtSlot(int slot)
throws org.apache.derby.iapi.error.StandardException
- Test if a record is deleted.
Locking Policy
No locks are obtained.
It is guaranteed that the page latch is not released by this method
updateFieldAtSlot
public RecordHandle updateFieldAtSlot(int slot, int fieldId, java.lang.Object newValue, org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo) throws org.apache.derby.iapi.error.StandardException
- Update a field within the record, replacing its current value with
the stored representation of newValue. Record is identified by slot.
If the field does not exist then it is added to the record, but only if
(fieldId - 1) exists.
RESOLVE right now it throws an exception if fieldId is not already on the record, not add the next one as advertised.Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is updated.
It is guaranteed that the page latch is not released by this method
fetchNumFieldsAtSlot
public int fetchNumFieldsAtSlot(int slot)
throws org.apache.derby.iapi.error.StandardException
- Fetch the number of fields in a record.
Locking Policy
No locks are obtained.
It is guaranteed that the page latch is not released by this method
deleteAtSlot
public RecordHandle deleteAtSlot(int slot, boolean delete, org.apache.derby.iapi.store.access.conglomerate.LogicalUndo undo) throws org.apache.derby.iapi.error.StandardException
- Mark the record at slot as deleted or undeleted according to delete flag.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is deleted. If record already deleted, and an attempt is made to delete it, an exception is thrown. If record not deleted, and an attempt is made to undelete it, an exception is thrown.
MT - latched
purgeAtSlot
public void purgeAtSlot(int slot,
int numpurges,
boolean needDataLogged)
throws org.apache.derby.iapi.error.StandardException
- Purge the row(s) from page.
Purge the row(s) from page, get rid of the row(s) and slot(s) - USE WITH CAUTION, please see entire description of this operation before attempting to use this. Starting from the specified slot, n rows will be purged. That is, rows that occupies from slot to slot+n-1 will be purged from the page.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the records are purged.
NOTE : CAVEAT
This operation will physically get rid of the row from the page, so if a subsequent operation on this page uses a slot that has been purged, then the undo of this operation will fail. 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 pageNOTE
Outstanding handles to purged rows are no longer valid, accessing them will cause an exception to be thrown.
NOTE : Data Logging for Purges
needDataLogged is used to specify whether data is required to be logged for purge operatios. Data Logging is required Only if the row can be reused or required for key search if a purge is rolled back;(rollback can occur if the system crashes in the middle of purges or some unexpected error condiditions rolled back. For example: 1)Btree expects the data to be there if a purge is rolled back; needDataLogged=true 2)Heaps does not care if data exist because only operation that can occur on a row whose purge rolled back is purging again.(needDataLogged=false) MT - latched
copyAndPurge
public void copyAndPurge(Page destPage, int src_slot, int num_rows, int dest_slot) throws org.apache.derby.iapi.error.StandardException
- move rows from one page to another, purging in the process.
Move from this page slot[src_slot] to slot[src_slot+num_rows-1] to destPage slot[dest_slot] to slot[dest_slot + num_rows - 1], in that order. Both this page and destPage must be latched and from the same container with the same page and record format.
Slot[src_slot] to slot[src_slot+numrows-1] will be purged from this page. RecordId on the dest page will be brand new and not in any particular order or range. RecordId of the purged rows in this page is never reused. Deleted and undeleted rows are copied over just the same. Exception will be thrown if this page does not have all the rows in the moved over range.
RESOLVE: reserve space now not copied over because in btree, a row never shrinks. When this routine is called by heap or by some page which will have shrunken row, then we need to add that
DestPage must have at least dest_slot row occupying slot[0] to slot[dest_slot-1]. DestPage must have enough space to take the copied over data. Rows that occupied slot number > dest_slot will be moved up the slot (I.e., slot[dest_slot] -> slot[dest_slot + num_rows]).
If this operation rolls back, this page (the src page) will get the rows back and the dest page will purge the rows that were copied - this is as if the rows were inserted into the dest page with INSERT_UNDO_WITH_PURGE.Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the rows are copied over and bore the records are purged. I.e, for num_rows moved, there will be 2*num_rows calls to lockRecordForWrite.
Use with caution
As with a normal purge, no space is reserved on this page for rollback of the purge, so you must commit before inserting any rows onto this page - unless those inserts are INSERT_UNDO_WITH_PURGE.
updateAtSlot
public RecordHandle updateAtSlot(int slot, java.lang.Object[] row, org.apache.derby.iapi.services.io.FormatableBitSet validColumns) throws org.apache.derby.iapi.error.StandardException
- Update the complete record identified by the slot.
Locking Policy
Calls the lockRecordForWrite() method of the LockingPolicy object passed to the openContainer() call before the record is undeleted. If record already deleted, an exception is thrown.
It is guaranteed that the page latch is not released by this method
unlatch
public void unlatch()
- Unlatch me, the page is exclusivly latched by its current user until
this method call is made.
After using this method the caller must throw away the reference to the Page object, e.g.ref.unlatch(); ref = null;
The page will be released automatically at the close of the container if this method is not called explictly.
MT - latched
recordCount
public int recordCount()
throws org.apache.derby.iapi.error.StandardException
- Return the number of records on the page. The returned count includes rows that are deleted,
i.e. it is the same as the number of slots on the page.
MT - latched
nonDeletedRecordCount
public int nonDeletedRecordCount()
throws org.apache.derby.iapi.error.StandardException
- Return the number of records on this page that are not marked as deleted.
MT - latched
setAuxObject
public void setAuxObject(AuxObject aux)
- Set the aux object for this page.
To clear the auxObject in the page, pass in a null AuxObject.
If the AuxObject has already been set, this method will
call auxObjectInvalidated() on the old aux objkect and replace it with aux.
MT - latched
getAuxObject
public AuxObject getAuxObject()
- Retrieve this page's aux object, returning null if there isn't one. The reference returned
must only be used while the page is latched, once unlatch is called the reference to the
aux object must be discarded.
MT - latched
setTimeStamp
public void setTimeStamp(PageTimeStamp ts) throws org.apache.derby.iapi.error.StandardException
- Set the time stamp to what is on page at this instance. No op if this
page does not support time stamp.
currentTimeStamp
public PageTimeStamp currentTimeStamp()
- Return a time stamp that can be used to identify the page of this
specific instance. For pages that don't support timestamp, returns
null.
equalTimeStamp
public boolean equalTimeStamp(PageTimeStamp ts) throws org.apache.derby.iapi.error.StandardException
- See if timeStamp for this page is the same as the current
instance of the page. Null timeStamp never equals the instance of the
page.
isLatched
public boolean isLatched()
|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> store >> [ raw overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC