public abstract class BTreeScan extends OpenBTree implements ScanManager
Concurrency Notes
The concurrency rules are derived from OpenBTree.
OpenBTree
Modifier and Type | Field and Description |
---|---|
protected DataValueDescriptor[][] |
fetchNext_one_slot_array
A 1 element array to turn fetchNext and fetch calls into
fetchNextGroup calls.
|
protected FetchDescriptor |
init_fetchDesc
The fetch descriptor which describes the row to be returned by the scan.
|
protected boolean |
init_forUpdate |
protected boolean |
init_hold |
protected FetchDescriptor |
init_lock_fetch_desc
A constant FetchDescriptor which describes the position of the
RowLocation field within the btree, currently always the last column).
|
protected Qualifier[][] |
init_qualifier |
protected Transaction |
init_rawtran
init_startKeyValue, init_qualifier, and init_stopKeyValue all are used
to store * references to the values passed in when ScanController.init()
is called.
|
protected FormatableBitSet |
init_scanColumnList |
protected DataValueDescriptor[] |
init_startKeyValue |
protected int |
init_startSearchOperator |
protected DataValueDescriptor[] |
init_stopKeyValue |
protected int |
init_stopSearchOperator |
protected DataValueDescriptor[] |
init_template |
protected boolean |
init_useUpdateLocks
Whether the scan should requests UPDATE locks which then will be
converted to X locks when the actual operation is performed.
|
protected int |
lock_operation
What kind of row locks to get during the scan.
|
protected static int |
SCAN_DONE |
protected static int |
SCAN_HOLD_INIT |
protected static int |
SCAN_HOLD_INPROGRESS |
protected static int |
SCAN_INIT |
protected static int |
SCAN_INPROGRESS |
(package private) BTreeRowPosition |
scan_position |
protected int |
scan_state
Delay positioning the table at the start position until the first
next() call.
|
protected int |
stat_numdeleted_rows_visited |
protected int |
stat_numpages_visited
Performance counters ...
|
protected int |
stat_numrows_qualified |
protected int |
stat_numrows_visited |
btree_undo, container, err_containerid, init_lock_level, init_open_user_scans, runtime_mem
GE, GT, NA
Constructor and Description |
---|
BTreeScan() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the scan.
|
boolean |
closeForEndTransaction(boolean closeHeldScan)
Close the scan, a commit or abort is about to happen.
|
boolean |
delete()
Delete the row at the current position of the scan.
|
void |
didNotQualify()
A call to allow client to indicate that current row does not qualify.
|
boolean |
doesCurrentPositionQualify()
Returns true if the current position of the scan still qualifies
under the set of qualifiers passed to the openScan().
|
void |
fetch(DataValueDescriptor[] row)
Fetch the row at the current position of the Scan.
|
private void |
fetch(DataValueDescriptor[] row,
boolean qualify)
Fetch the row at the current position of the Scan.
|
void |
fetchLocation(RowLocation templateLocation)
Fetch the location of the current position in the scan.
|
boolean |
fetchNext(DataValueDescriptor[] row)
Fetch the row at the next position of the Scan.
|
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] rowloc_array)
Fetch the next N rows from the table.
|
int |
fetchNextGroup(DataValueDescriptor[][] row_array,
RowLocation[] old_rowloc_array,
RowLocation[] new_rowloc_array) |
protected abstract int |
fetchRows(BTreeRowPosition pos,
DataValueDescriptor[][] row_array,
RowLocation[] rowloc_array,
BackingStoreHashtable hash_table,
long max_rowcnt,
int[] key_column_numbers)
Fetch the next N rows from the table.
|
void |
fetchSet(long max_rowcnt,
int[] key_column_numbers,
BackingStoreHashtable hash_table)
Insert all rows that qualify for the current scan into the input
Hash table.
|
void |
fetchWithoutQualify(DataValueDescriptor[] row)
Fetch the row at the current position of the Scan without applying the
qualifiers.
|
RecordHandle |
getCurrentRecordHandleForDebugging() |
ScanInfo |
getScanInfo()
Return ScanInfo object which describes performance of scan.
|
void |
init(TransactionManager xact_manager,
Transaction rawtran,
boolean hold,
int open_mode,
int lock_level,
BTreeLockingPolicy btree_locking_policy,
FormatableBitSet scanColumnList,
DataValueDescriptor[] startKeyValue,
int startSearchOperator,
Qualifier[][] qualifier,
DataValueDescriptor[] stopKeyValue,
int stopSearchOperator,
BTree conglomerate,
LogicalUndo undo,
StaticCompiledOpenConglomInfo static_info,
DynamicCompiledOpenConglomInfo dynamic_info)
Initialize the scan for use.
|
private void |
initScanParams(DataValueDescriptor[] startKeyValue,
int startSearchOperator,
Qualifier[][] qualifier,
DataValueDescriptor[] stopKeyValue,
int stopSearchOperator)
Shared initialization code between init() and reopenScan().
|
boolean |
isCurrentPositionDeleted()
Returns true if the current position of the scan is at a
deleted row.
|
(package private) static boolean |
isEmpty(Page page)
Check if a B-tree page is empty.
|
boolean |
isHeldAfterCommit()
Return true is the scan has been closed after a commit, but was
opened with holdability and can be reopened using
positionAtRowLocation.
|
boolean |
isKeyed()
Return whether this is a keyed conglomerate.
|
RowLocation |
newRowLocationTemplate()
Return a row location object of the correct type to be
used in calls to fetchLocation.
|
boolean |
next()
Move to the next position in the scan.
|
protected void |
positionAtDoneScan(BTreeRowPosition pos)
Do work necessary to close a scan.
|
protected void |
positionAtDoneScanFromClose(BTreeRowPosition pos)
Do any necessary work to complete the scan.
|
protected void |
positionAtNextPage(BTreeRowPosition pos)
Position scan to 0 slot on next page.
|
protected void |
positionAtPreviousPage()
Position the scan after the last row on the previous page.
|
boolean |
positionAtRowLocation(RowLocation rLoc)
Positions the scan at row location and locks the row.
|
protected void |
positionAtStartForForwardScan(BTreeRowPosition pos)
Position scan at "start" position for a forward scan.
|
(package private) abstract void |
positionAtStartPosition(BTreeRowPosition pos)
Position scan at "start" position.
|
protected boolean |
process_qualifier(DataValueDescriptor[] row)
process_qualifier - Determine if a row meets all qualifier conditions.
|
void |
reopenScan(DataValueDescriptor[] startKeyValue,
int startSearchOperator,
Qualifier[][] qualifier,
DataValueDescriptor[] stopKeyValue,
int stopSearchOperator)
Reposition the current scan.
|
void |
reopenScanByRowLocation(RowLocation startRowLocation,
Qualifier[][] qualifier)
Reposition the current scan.
|
boolean |
replace(DataValueDescriptor[] row,
FormatableBitSet validColumns)
Replace the entire row at the current position of the scan.
|
protected boolean |
reposition(BTreeRowPosition pos,
boolean missing_row_for_key_ok)
Reposition the scan leaving and reentering the access layer.
|
(package private) void |
savePositionAndReleasePage()
Shortcut for for savePositionAndReleasePage(null,null).
|
(package private) void |
savePositionAndReleasePage(DataValueDescriptor[] partialKey,
int[] vcols)
Save the current scan position by key and release the latch on the leaf
that's being scanned.
|
java.lang.String |
toString() |
checkConsistency, debugConglomerate, getColumnSortOrderInfo, getConglomerate, getContainer, getContainerHandle, getEstimatedRowCount, getHeight, getHold, getLockingPolicy, getLockLevel, getOpenMode, getRawTran, getRuntimeMem, getSpaceInfo, getXactMgr, init, isClosed, isIndexableRowConsistent, isTableLocked, reopen, setEstimatedRowCount, setLockingPolicy, test_errors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isTableLocked
getEstimatedRowCount, setEstimatedRowCount
protected Transaction init_rawtran
protected boolean init_forUpdate
protected FormatableBitSet init_scanColumnList
protected DataValueDescriptor[] init_template
protected DataValueDescriptor[] init_startKeyValue
protected int init_startSearchOperator
protected Qualifier[][] init_qualifier
protected DataValueDescriptor[] init_stopKeyValue
protected int init_stopSearchOperator
protected boolean init_hold
protected FetchDescriptor init_fetchDesc
protected FetchDescriptor init_lock_fetch_desc
BTreeRowPosition scan_position
protected boolean init_useUpdateLocks
protected static final int SCAN_INIT
protected static final int SCAN_INPROGRESS
protected static final int SCAN_DONE
protected static final int SCAN_HOLD_INIT
protected static final int SCAN_HOLD_INPROGRESS
protected int scan_state
protected int stat_numpages_visited
protected int stat_numrows_visited
protected int stat_numrows_qualified
protected int stat_numdeleted_rows_visited
protected int lock_operation
protected DataValueDescriptor[][] fetchNext_one_slot_array
protected abstract int fetchRows(BTreeRowPosition pos, DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers) throws StandardException
Utility routine used by both fetchSet() and fetchNextGroup().
StandardException
- Standard exception policy.private void initScanParams(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException
Basically save away input parameters describing qualifications for the scan, and do some error checking.
StandardException
- Standard exception policy.protected void positionAtStartForForwardScan(BTreeRowPosition pos) throws StandardException
Positions the scan to the slot just before the first record to be returned from the scan. Returns the start page latched, and sets "current_slot" to the slot number.
StandardException
- Standard exception policy.protected void positionAtNextPage(BTreeRowPosition pos) throws StandardException
Position to next page, keeping latch on previous page until we have latch on next page. This routine releases the latch on current_page once it has successfully gotten the latch on the next page.
pos
- current row position of the scan.StandardException
- Standard exception policy.protected void positionAtPreviousPage() throws StandardException, WaitError
Position the scan after the last row on the previous page. Hold the latch on the current page until the previous page has been latched. If the immediate left sibling is empty, move further until a non-empty page is found or there are no more leaves to be found. The latch on the current page will be held until a non-empty left sibling page is found.
This method never waits for a latch, as waiting for latches while
holding another latch is only allowed when moving forward in the B-tree.
Waiting while moving backward may result in deadlocks with scanners
going forward. A WaitError
is thrown if the previous page cannot
be latched without waiting. scan_position.current_leaf
will
point to the same page as before the method was called in the case where
a WaitError
is thrown, and the page will still be latched.
StandardException
- standard exception policyWaitError
- if the previous page cannot be latched immediatelystatic boolean isEmpty(Page page) throws StandardException
page
- the B-tree page to checkStandardException
- standard exception policyabstract void positionAtStartPosition(BTreeRowPosition pos) throws StandardException
Positions the scan to the slot just before the first record to be returned from the scan. Returns the start page latched, and sets "current_slot" to the slot number.
StandardException
- Standard exception policy.protected void positionAtDoneScanFromClose(BTreeRowPosition pos) throws StandardException
pos
- current row position of the scan.StandardException
- Standard exception policy.protected void positionAtDoneScan(BTreeRowPosition pos) throws StandardException
This routine can only be called "inline" from other btree routines, as it counts on the state of the pos to be correct.
Closing a scan from close() must handle long jumps from exceptions where the state of pos may not be correct. The easiest case is a lock timeout which has caused us not to have a latch on a page, but pos still thinks there is a latch. This is the easiest but other exceptions can also caused the same state at close() time.
StandardException
protected boolean process_qualifier(DataValueDescriptor[] row) throws StandardException
Check all qualifiers in the qualifier array against row. Return true if all compares specified by the qualifier array return true, else return false.
It is up to caller to make sure qualifier list is non-null.
row
- The row with the same partial column list as the
row returned by the current scan.StandardException
- Standard exception policy.protected boolean reposition(BTreeRowPosition pos, boolean missing_row_for_key_ok) throws StandardException
When a scan leaves access it saves the RecordHandle of the record on the page. There are 2 cases to consider when trying to reposition the scan when re-entering access: o ROW has not moved off the page. If the row has not moved then the RecordHandle we have saved away is valid, and we just call RawStore to reposition on that RecordHandle (RawStore takes care of the row moving within the page). o ROW has moved off the page. This can only happen in the case of a btree split. In that case the splitter will have caused all scans positioned on this page within the same transaction to save a copy of the row that the scan was positioned on. Then to reposition the scan it is necessary to research the tree from the top using the copy of the row. There are a few cases where it is possible that the key no longer exists in the table. In the case of a scan held open across commit it is easy to imagine that the row the scan was positioned on could be deleted and subsequently purged from the table all before the scan resumes. Also in the case of read uncommitted the scan holds no lock on the current row, so it could be purged - in the following scenario for instance: read uncommitted transaction 1 opens scan and positions on row (1,2), transaction 2 deletes (1,2) and commits, transaction 1 inserts (1,3) which goes to same page as (1,2) and is going to cause a split, transaction 1 saves scan position as key, and then purges row (1, 2), when transaction 1 resumes scan (1, 2) no longer exists. missing_row_for_key_ok parameter is added as a sanity check to make sure it ok that repositioning does not go to same row that we were repositioned on.
pos
- position to set the scan to.missing_row_for_key_ok
- if true and exact key is not found then
scan is just set to key just left of
the key (thus a next will move to the
key just after "pos")StandardException
- Standard exception policy.public void init(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, BTreeLockingPolicy btree_locking_policy, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, BTree conglomerate, LogicalUndo undo, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException
Any changes to this method may have to be reflected in close as well.
The btree init opens the container (super.init), and stores away the state of the qualifiers. The actual searching for the first position is delayed until the first next() call.
StandardException
- Standard exception policy.public void close() throws StandardException
close
in interface GenericScanController
close
in class OpenBTree
StandardException
- Standard exception policy.public boolean delete() throws StandardException
delete
in interface ScanController
StandardException
- Standard exception policy.ScanController.delete()
public void didNotQualify() throws StandardException
Indicates to the ScanController that the current row does not qualify for the scan. If the isolation level of the scan allows, this may result in the scan releasing the lock on this row.
Note that some scan implimentations may not support releasing locks on non-qualifying rows, or may delay releasing the lock until sometime later in the scan (ie. it may be necessary to keep the lock until either the scan is repositioned on the next row or page).
This call should only be made while the scan is positioned on a current valid row.
didNotQualify
in interface ScanController
StandardException
- Standard exception policy.public boolean doesCurrentPositionQualify() throws StandardException
This case can come about if the current scan or another scan on the same table in the same transaction deleted the row or changed columns referenced by the qualifier after the next() call which positioned the scan at this row.
Note that for comglomerates which don't support update, like btree's, there is no need to recheck the qualifiers.
The results of a fetch() performed on a scan positioned on a deleted row are undefined.
doesCurrentPositionQualify
in interface ScanController
StandardException
- Standard exception policy.private void fetch(DataValueDescriptor[] row, boolean qualify) throws StandardException
row
- The row into which the value of the current
position in the scan is to be stored.qualify
- indicates whether the qualifiers should be applied.StandardException
- Standard exception policy.public boolean isHeldAfterCommit() throws StandardException
ScanController
isHeldAfterCommit
in interface ScanController
StandardException
- Standard exception policy.ScanController.isHeldAfterCommit()
public void fetch(DataValueDescriptor[] row) throws StandardException
fetch
in interface ScanController
row
- The row into which the value of the current
position in the scan is to be stored.StandardException
- Standard exception policy.ScanController.fetch(org.apache.derby.iapi.types.DataValueDescriptor[])
public void fetchWithoutQualify(DataValueDescriptor[] row) throws StandardException
fetchWithoutQualify
in interface ScanController
row
- The row into which the value of the current
position in the scan is to be stored.StandardException
- Standard exception policy.ScanController.fetchWithoutQualify(org.apache.derby.iapi.types.DataValueDescriptor[])
public ScanInfo getScanInfo() throws StandardException
Return ScanInfo object which contains information about the current scan.
getScanInfo
in interface GenericScanController
StandardException
- Standard exception policy.ScanInfo
public boolean isCurrentPositionDeleted() throws StandardException
isCurrentPositionDeleted
in interface ScanController
StandardException
- Standard exception policy.public boolean isKeyed()
isKeyed
in interface GenericScanController
public boolean positionAtRowLocation(RowLocation rLoc) throws StandardException
ScanController
positionAtRowLocation
in interface ScanController
rLoc
- RowLocation for the new position for the scan. The
RowLocation submitted should be a RowLocation which has
previously been returned by this ScanController.StandardException
- Standard exception policy.Not implemented for this class
public boolean next() throws StandardException
next
in interface GroupFetchScanController
next
in interface ScanController
StandardException
- Standard exception policy.ScanController.next()
public boolean fetchNext(DataValueDescriptor[] row) throws StandardException
fetchNext
in interface ScanController
row
- The template row into which the value
of the next position in the scan is to be stored.StandardException
- Standard exception policy.ScanController.fetch(org.apache.derby.iapi.types.DataValueDescriptor[])
,
RowUtil
public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array) throws StandardException
The client allocates an array of N rows and passes it into the fetchNextSet() call. This routine does the equivalent of N fetchNext() calls, filling in each of the rows in the array. Locking is performed exactly as if the N fetchNext() calls had been made.
It is up to Access how many rows to return. fetchNextSet() will return how many rows were filled in. If fetchNextSet() returns 0 then the scan is complete, (ie. the scan is in the same state as if fetchNext() had returned false). If the scan is not complete then fetchNext() will return (1 <= row_count <= N).
The current position of the scan is undefined if fetchNextSet() is used (ie. mixing fetch()/fetchNext() and fetchNextSet() calls in a single scan does not work). This is because a fetchNextSet() request for 5 rows from a heap where the first 2 rows qualify, but no other rows qualify will result in the scan being positioned at the end of the table, while if 5 rows did qualify the scan will be positioned on the 5th row.
Qualifiers, start and stop positioning of the openscan are applied just as in a normal scan.
The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description.
Expected usage: // allocate an array of 5 empty row templates DataValueDescriptor[][] row_array = allocate_row_array(5); int row_cnt = 0; scan = openScan(); while ((row_cnt = scan.fetchNextSet(row_array) != 0) { // I got "row_cnt" rows from the scan. These rows will be // found in row_array[0] through row_array[row_cnt - 1] }
RESOLVE - This interface is being provided so that we can prototype the performance results it can achieve. If it looks like this interface is useful, it is very likely we will look into a better way to tie together the now 4 different fetch interfaces: fetch, fetchNext(), fetchNextGroup(), and fetchSet().
fetchNextGroup
in interface GroupFetchScanController
row_array
- The array of rows to copy rows into.
row_array[].length must >= 1. This routine
assumes that all entries in the array
contain complete template rows.rowloc_array
- If non-null, the array of row locations to
copy into. If null, no row locations are
retrieved.StandardException
- Standard exception policy.public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] old_rowloc_array, RowLocation[] new_rowloc_array) throws StandardException
fetchNextGroup
in interface GroupFetchScanController
StandardException
public void fetchSet(long max_rowcnt, int[] key_column_numbers, BackingStoreHashtable hash_table) throws StandardException
This routine scans executes the entire scan as described in the openScan call. For every qualifying unique row value an entry is placed into the HashTable. For unique row values the entry in the BackingStoreHashtable has a key value of the object stored in row[key_column_number], and the value of the data is row. For row values with duplicates, the key value is also row[key_column_number], but the value of the data is a Vector of rows. The caller will have to call "instanceof" on the data value object if duplicates are expected, to determine if the data value of the Hashtable entry is a row or is a Vector of rows.
Note, that for this routine to work efficiently the caller must ensure that the object in row[key_column_number] implements the hashCode and equals method as appropriate for it's datatype.
It is expected that this call will be the first and only call made in an openscan. Qualifiers and stop position of the openscan are applied just as in a normal scan. This call is logically equivalent to the caller performing the following: import java.util.Hashtable; hash_table = new Hashtable(); while (next()) { row = create_new_row(); fetch(row); if ((duplicate_value = hash_table.put(row[key_column_number], row)) != null) { Vector row_vec; // inserted a duplicate if ((duplicate_value instanceof vector)) { row_vec = (Vector) duplicate_value; } else { // allocate vector to hold duplicates row_vec = new Vector(2); // insert original row into vector row_vec.addElement(duplicate_value); // put the vector as the data rather than the row hash_table.put(row[key_column_number], row_vec); } // insert new row into vector row_vec.addElement(row); } }
The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description. RESOLVE - is this ok? or should I hard code somehow the row to be the first column and the row location?
Currently it is only possible to hash on the first column in the conglomerate, in the future we may change the interface to allow hashing either on a different column or maybe on a combination of columns.
No overflow to external storage is provided, so calling this routine on a 1 gigabyte conglomerate will incur at least 1 gigabyte of memory (probably failing with a java out of memory condition). If this routine gets an out of memory condition, or if "max_rowcnt" is exceeded then then the routine will give up, empty the Hashtable, and return "false."
On exit from this routine, whether the fetchSet() succeeded or not the scan is complete, it is positioned just the same as if the scan had been drained by calling "next()" until it returns false (ie. fetchNext() and next() calls will return false). reopenScan() can be called to restart the scan.
RESOLVE - until we get row counts what should we do for sizing the the size, capasity, and load factor of the hash table. For now it is up to the caller to create the Hashtable, Access does not reset any parameters.
RESOLVE - I am not sure if access should be in charge of allocating the new row objects. I know that I can do this in the case of btree's, but I don't think I can do this in heaps. Maybe this is solved by work to be done on the sort interface.
fetchSet
in interface ScanManager
max_rowcnt
- The maximum number of rows to insert into the
Hash table. Pass in -1 if there is no maximum.key_column_numbers
- The column numbers of the columns in the
scan result row to be the key to the Hashtable.
"0" is the first column in the scan result
row (which may be different than the first
column in the row in the table of the scan).hash_table
- The java HashTable to load into.StandardException
- Standard exception policy.public final void reopenScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException
reopenScan
in interface GenericScanController
startKeyValue
- An indexable row which holds a
(partial) key value which, in combination with the
startSearchOperator, defines the starting position of
the scan. If null, the starting position of the scan
is the first row of the conglomerate.startSearchOperator
- an operator which defines
how the startKeyValue is to be searched for. If
startSearchOperation is ScanController.GE, the scan starts on
the first row which is greater than or equal to the
startKeyValue. If startSearchOperation is ScanController.GT,
the scan starts on the first row whose key is greater than
startKeyValue. The startSearchOperation parameter is
ignored if the startKeyValue parameter is null.qualifier
- An array of qualifiers which, applied
to each key, restrict the rows returned by the scan. Rows
for which any one of the qualifiers returns false are not
returned by the scan. If null, all rows are returned.stopKeyValue
- An indexable row which holds a
(partial) key value which, in combination with the
stopSearchOperator, defines the ending position of
the scan. If null, the ending position of the scan
is the last row of the conglomerate.stopSearchOperator
- an operator which defines
how the stopKeyValue is used to determine the scan stopping
position. If stopSearchOperation is ScanController.GE, the scan
stops just before the first row which is greater than or
equal to the stopKeyValue. If stopSearchOperation is
ScanController.GT, the scan stops just before the first row whose
key is greater than startKeyValue. The stopSearchOperation
parameter is ignored if the stopKeyValue parameter is null.StandardException
- Standard exception policy.public void reopenScanByRowLocation(RowLocation startRowLocation, Qualifier[][] qualifier) throws StandardException
The statistics gathered by the scan are not reset to 0 by a reopenScan(), rather they continue to accumulate.
Note that this operation is currently only supported on Heap conglomerates. Also note that order of rows within are heap are not guaranteed, so for instance positioning at a RowLocation in the "middle" of a heap, then inserting more data, then continuing the scan is not guaranteed to see the new rows - they may be put in the "beginning" of the heap.
reopenScanByRowLocation
in interface GenericScanController
startRowLocation
- An existing RowLocation within the conglomerate,
at which to position the start of the scan. The scan will begin at this
location and continue forward until the end of the conglomerate.
Positioning at a non-existent RowLocation (ie. an invalid one or one that
had been deleted), will result in an exception being thrown when the
first next operation is attempted.qualifier
- An array of qualifiers which, applied
to each key, restrict the rows returned by the scan. Rows
for which any one of the qualifiers returns false are not
returned by the scan. If null, all rows are returned.StandardException
- Standard exception policy.public void fetchLocation(RowLocation templateLocation) throws StandardException
fetchLocation
in interface ScanController
StandardException
- Standard exception policy.ScanController.fetchLocation(org.apache.derby.iapi.types.RowLocation)
public RowLocation newRowLocationTemplate() throws StandardException
newRowLocationTemplate
in interface GenericScanController
StandardException
- Standard exception policy.GenericScanController.newRowLocationTemplate()
public boolean replace(DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException
replace
in interface ScanController
StandardException
- Standard exception policy.ScanController.replace(org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.services.io.FormatableBitSet)
public boolean closeForEndTransaction(boolean closeHeldScan) throws StandardException
closeForEndTransaction
in interface ScanManager
closeHeldScan
- If true, means to close scan even if it has been
opened to be kept opened across commit. This is
used to close these scans on abort.StandardException
- Standard exception policy.void savePositionAndReleasePage(DataValueDescriptor[] partialKey, int[] vcols) throws StandardException
reposition()
.partialKey
- known parts of the key that should be saved, or
null
if the entire key is unknown and will have to be fetched
from the pagevcols
- an array which tells which columns of the partial key are
valid (key columns that have 0 in this array are not valid, and their
values must be fetched from the page), or null
if all the
columns are validStandardException
- if an error occurs while saving the positionreposition(BTreeRowPosition, boolean)
void savePositionAndReleasePage() throws StandardException
StandardException
public RecordHandle getCurrentRecordHandleForDebugging()
public java.lang.String toString()
toString
in class java.lang.Object
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.