You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/07/03 08:03:38 UTC
svn commit: r552677 -
/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
Author: kahatlen
Date: Mon Jul 2 23:03:37 2007
New Revision: 552677
URL: http://svn.apache.org/viewvc?view=rev&rev=552677
Log:
DERBY-2878 (partial) Scan protection handle could be cached in BasePage
Factor out common code in BTreeScan for unlocking the current scan.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java?view=diff&rev=552677&r1=552676&r2=552677
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java Mon Jul 2 23:03:37 2007
@@ -718,8 +718,7 @@
pos, init_forUpdate);
}
- this.getLockingPolicy().unlockScan(
- pos.current_leaf.page.getPageNumber());
+ unlockCurrentScan(pos);
pos.current_leaf.release();
pos.current_leaf = pos.next_leaf;
@@ -804,11 +803,7 @@
// has a null locking policy so the close of that container does not
// release this lock, need to explicitly unlock it here or when the
// scan is closed as part of the abort the lock will not be released.
- if (pos.current_scan_pageno != 0)
- {
- this.getLockingPolicy().unlockScan(pos.current_scan_pageno);
- pos.current_scan_pageno = 0;
- }
+ unlockCurrentScan(pos);
pos.current_slot = Page.INVALID_SLOT_NUMBER;
pos.current_rh = null;
@@ -842,11 +837,7 @@
// has a null locking policy so the close of that container does not
// release this lock, need to explicitly unlock it here or when the
// scan is closed as part of the abort the lock will not be released.
- if (pos.current_scan_pageno != 0)
- {
- this.getLockingPolicy().unlockScan(pos.current_scan_pageno);
- pos.current_scan_pageno = 0;
- }
+ unlockCurrentScan(pos);
pos.current_slot = Page.INVALID_SLOT_NUMBER;
pos.current_rh = null;
@@ -1153,6 +1144,18 @@
return(true);
}
+ /**
+ * Unlock the scan protection row for the current scan.
+ *
+ * @param pos position of the scan
+ */
+ private void unlockCurrentScan(BTreeRowPosition pos) {
+ if (pos.current_scan_pageno != 0L) {
+ getLockingPolicy().unlockScan(pos.current_scan_pageno);
+ pos.current_scan_pageno = 0L;
+ }
+ }
+
/*
** Public Methods of BTreeScan
*/
@@ -2120,12 +2123,7 @@
// has a null locking policy so the close of that container does not
// release this lock, need to explicitly unlock it here or when the
// scan is closed as part of the abort the lock will not be released.
- if (scan_position.current_scan_pageno != 0)
- {
- this.getLockingPolicy().unlockScan(
- scan_position.current_scan_pageno);
- scan_position.current_scan_pageno = 0;
- }
+ unlockCurrentScan(scan_position);
scan_position.current_slot = Page.INVALID_SLOT_NUMBER;
scan_position.current_rh = null;
@@ -2344,13 +2342,7 @@
scan_position.current_slot = Page.INVALID_SLOT_NUMBER;
// release scan lock now that the row is saved away.
-
- if (scan_position.current_scan_pageno != 0)
- {
- this.getLockingPolicy().unlockScan(
- scan_position.current_scan_pageno);
- scan_position.current_scan_pageno = 0;
- }
+ unlockCurrentScan(scan_position);
}
else
@@ -2465,13 +2457,7 @@
scan_position.current_slot = Page.INVALID_SLOT_NUMBER;
// release the scan lock now that we have saved away the row.
-
- if (scan_position.current_scan_pageno != 0)
- {
- this.getLockingPolicy().unlockScan(
- scan_position.current_scan_pageno);
- scan_position.current_scan_pageno = 0;
- }
+ unlockCurrentScan(scan_position);
}
}
}