Class B2IRowLockingRR
- java.lang.Object
-
- org.apache.derby.impl.store.access.btree.index.B2IRowLocking3
-
- org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR
-
- All Implemented Interfaces:
BTreeLockingPolicy
- Direct Known Subclasses:
B2IRowLocking2
class B2IRowLockingRR extends B2IRowLocking3 implements BTreeLockingPolicy
-
-
Field Summary
-
Fields inherited from class org.apache.derby.impl.store.access.btree.index.B2IRowLocking3
base_cc, open_btree
-
-
Constructor Summary
Constructors Constructor Description B2IRowLockingRR(Transaction rawtran, int lock_level, LockingPolicy locking_policy, ConglomerateController base_cc, OpenBTree open_btree)
Constructors for This class:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
lockScanRow(OpenBTree open_btree, BTreeRowPosition pos, FetchDescriptor lock_fetch_desc, DataValueDescriptor[] lock_template, RowLocation lock_row_loc, boolean previous_key_lock, boolean forUpdate, int lock_operation)
Lock a row as part of doing the scan.void
unlockScanRecordAfterRead(BTreeRowPosition pos, boolean forUpdate)
Unlock a record after it has been locked for read.-
Methods inherited from class org.apache.derby.impl.store.access.btree.index.B2IRowLocking3
_lockScanRow, lockNonScanPreviousRow, lockNonScanRow, lockNonScanRowOnPage, lockScanCommittedDeletedRow
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.impl.store.access.btree.BTreeLockingPolicy
lockNonScanPreviousRow, lockNonScanRow, lockNonScanRowOnPage, lockScanCommittedDeletedRow
-
-
-
-
Constructor Detail
-
B2IRowLockingRR
B2IRowLockingRR(Transaction rawtran, int lock_level, LockingPolicy locking_policy, ConglomerateController base_cc, OpenBTree open_btree)
Constructors for This class:
-
-
Method Detail
-
lockScanRow
public boolean lockScanRow(OpenBTree open_btree, BTreeRowPosition pos, FetchDescriptor lock_fetch_desc, DataValueDescriptor[] lock_template, RowLocation lock_row_loc, boolean previous_key_lock, boolean forUpdate, int lock_operation) throws StandardException
Lock a row as part of doing the scan.Lock the row at the given slot (or the previous row if slot is 0).
If this routine returns true all locks were acquired while maintaining the latch on leaf. If this routine returns false, locks may or may not have been acquired, and the routine should be called again after the client has researched the tree to reget the latch on the appropriate page.
- Specified by:
lockScanRow
in interfaceBTreeLockingPolicy
- Overrides:
lockScanRow
in classB2IRowLocking3
- Parameters:
open_btree
- The open_btree to associate latches with - used if routine has to scan backward.pos
- The position of the row to lock.lock_template
- A scratch area to use to read in rows.previous_key_lock
- Is this a previous key lock call?forUpdate
- Is the scan for update or for read only.lock_operation
- For what operation are we requesting the lock, this should be one of the following 4 options: LOCK_READ [read lock], (LOCK_INS | LOCK_UPD) [ lock for insert], (LOCK_INSERT_PREVKEY | LOCK_UPD) [lock for previous key to insert], (LOCK_UPD) [lock for delete or replace]- Returns:
- Whether locks were acquired without releasing latch on leaf.
- Throws:
StandardException
- Standard exception policy.
-
unlockScanRecordAfterRead
public void unlockScanRecordAfterRead(BTreeRowPosition pos, boolean forUpdate) throws StandardException
Unlock a record after it has been locked for read.In repeatable read only unlock records which "did not qualify". For example in a query like "select * from foo where a = 1" on a table with no index it is only necessary to hold locks on rows where a=1, but in the process of finding those rows the system will get locks on other rows to verify they are committed before applying the qualifier. Those locks can be released under repeatable read isolation.
if it is forUpdate then get S lock and release U lock, else there is nothing to do in serializable - we keep the S locks until end of transaction.
- Specified by:
unlockScanRecordAfterRead
in interfaceBTreeLockingPolicy
- Overrides:
unlockScanRecordAfterRead
in classB2IRowLocking3
- Parameters:
forUpdate
- Is the scan for update or for read only.pos
- Data structure that defines the current position in the scan to be unlocked.- Throws:
StandardException
- Standard exception policy.
-
-