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 2009/04/23 11:02:28 UTC
svn commit: r767861 - in /db/derby/code/branches/10.4/java:
engine/org/apache/derby/impl/store/access/btree/BTreeController.java
testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java
Author: kahatlen
Date: Thu Apr 23 09:02:27 2009
New Revision: 767861
URL: http://svn.apache.org/viewvc?rev=767861&view=rev
Log:
DERBY-4097: WaitError in NullableUniqueConstraintTest.testMixedInsertDelete
Merged fix from trunk (revision 767143).
Modified:
db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java
Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java?rev=767861&r1=767860&r2=767861&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java (original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java Thu Apr 23 09:02:27 2009
@@ -379,8 +379,8 @@
LeafControlRow originalLeaf = leaf;
while (leaf != null) {
if (slot == 0) {
+ LeafControlRow oldLeaf = leaf;
try {
- LeafControlRow oldLeaf = leaf;
//slot is pointing before the first slot
//get left sibiling
leaf = (LeafControlRow) leaf.getLeftSibling(this);
@@ -398,7 +398,14 @@
// of the loop body to get the slot number rechecked.
continue;
} catch (WaitError we) {
- throw StandardException.plainWrapException(we);
+ // DERBY-4097: Couldn't latch the left sibling without
+ // waiting. Release all latches and rescan from top of
+ // B-tree to prevent deadlock.
+ if (newLeaf) {
+ oldLeaf.release();
+ }
+ originalLeaf.release();
+ return RESCAN_REQUIRED;
}
}
rh = leaf.page.fetchFromSlot(null, slot, rows, null, true);
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java?rev=767861&r1=767860&r2=767861&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NullableUniqueConstraintTest.java Thu Apr 23 09:02:27 2009
@@ -473,7 +473,11 @@
// The error happened most frequently in the second iteration, but
// it didn't always, so we repeat it ten times to increase the
// likelihood of triggering the bug.
- for (int i = 0; i < 10; i++) {
+ // DERBY-4097: Increase the number of iterations to increase the
+ // likelihood of exposing another timing-dependent problem with a
+ // WaitError caused by a conflict between the post-commit thread
+ // and the user thread.
+ for (int i = 0; i < 100; i++) {
for (int j = 0; j < 1000; j++) {
insert.setInt(1, j);
insert.addBatch();