incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1087604 - in /incubator/lcf/upstream/derby: ./ java/engine/org/apache/derby/impl/services/locks/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Fri, 01 Apr 2011 07:00:28 GMT
Author: kwright
Date: Fri Apr  1 07:00:28 2011
New Revision: 1087604

URL: http://svn.apache.org/viewvc?rev=1087604&view=rev
Log:
Fold in patch for DERBY-5073 (merging r1081455 from derby trunk).

Added:
    incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DeadlockDetectionTest.java
      - copied unchanged from r1081455, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DeadlockDetectionTest.java
Modified:
    incubator/lcf/upstream/derby/   (props changed)
    incubator/lcf/upstream/derby/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
    incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Propchange: incubator/lcf/upstream/derby/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr  1 07:00:28 2011
@@ -1 +1 @@
-/db/derby/code/trunk:1035603,1036769,1038813,1039084,1039268
+/db/derby/code/trunk:1035603,1036769,1038813,1039084,1039268,1081455

Modified: incubator/lcf/upstream/derby/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
URL: http://svn.apache.org/viewvc/incubator/lcf/upstream/derby/java/engine/org/apache/derby/impl/services/locks/Deadlock.java?rev=1087604&r1=1087603&r2=1087604&view=diff
==============================================================================
--- incubator/lcf/upstream/derby/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
(original)
+++ incubator/lcf/upstream/derby/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
Fri Apr  1 07:00:28 2011
@@ -167,40 +167,59 @@ inner:		for (;;) {
 				}
 				chain.push(space);
 
-				Lock waitingLock = (Lock) waiters.get(space);
-				if (waitingLock == null) {
-					// end of the road, no deadlock in this path
-					// pop items until the previous Stack
-					rollback(chain);
-					continue outer;
-				}
+                skip_space: while (true) {
 
-				// Is a LockControl or another ActiveLock
-				Object waitOn = waiters.get(waitingLock); 
-				if (waitOn instanceof LockControl) {
-
-					LockControl waitOnControl = (LockControl) waitOn;
-
-					// This lock control may have waiters but no
-					// one holding the lock. This is true if lock
-					// has just been released but the waiters haven't
-					// woken up, or they are trying to get the synchronization we hold.
-
-					if (waitOnControl.isUnlocked()) {
-						// end of the road, no deadlock in this path
-						// pop items until the previous Stack
-						rollback(chain);
-						continue outer;
-					}
+                    Lock waitingLock = (Lock) waiters.get(space);
+                    if (waitingLock == null) {
+                        // end of the road, no deadlock in this path
+                        // pop items until the previous Stack
+                        rollback(chain);
+                        continue outer;
+                    }
 
-					chain.push(waitOnControl.getGrants());
+                    // Is a LockControl or another ActiveLock
+                    Object waitOn = waiters.get(waitingLock);
+                    if (waitOn instanceof LockControl) {
+
+                        LockControl waitOnControl = (LockControl) waitOn;
+
+                        // This lock control may have waiters but no
+                        // one holding the lock. This is true if lock
+                        // has just been released but the waiters haven't
+                        // woken up, or they are trying to get the
+                        // synchronization we hold.
+
+                        if (waitOnControl.isUnlocked()) {
+                            // end of the road, no deadlock in this path
+                            // pop items until the previous Stack
+                            rollback(chain);
+                            continue outer;
+                        }
 
-					continue outer;
-				} else {
-					// simply waiting on another waiter
-					space = waitingLock.getCompatabilitySpace();
-				}
-		}
+                        chain.push(waitOnControl.getGrants());
+
+                        continue outer;
+                    } else {
+                        // simply waiting on another waiter
+                        ActiveLock waitOnLock = (ActiveLock) waitOn;
+
+                        space = waitOnLock.getCompatabilitySpace();
+
+                        if (waitingLock.getLockable().requestCompatible(
+                                waitingLock.getQualifier(),
+                                waitOnLock.getQualifier())) {
+                            // We're behind another waiter in the queue, but we
+                            // request compatible locks, so we'll get the lock
+                            // too once it gets it. Since we're not actually
+                            // blocked by the waiter, skip it and see what's
+                            // blocking it instead.
+                            continue skip_space;
+                        } else {
+                            continue inner;
+                        }
+                    }
+                }
+            }
 		}
 
 		return null;

Modified: incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1087604&r1=1087603&r2=1087604&view=diff
==============================================================================
--- incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ incubator/lcf/upstream/derby/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Fri Apr  1 07:00:28 2011
@@ -149,6 +149,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(UniqueConstraintSetNullTest.suite());
         suite.addTest(UniqueConstraintMultiThreadedTest.suite());
         suite.addTest(ViewsTest.suite());
+        suite.addTest(DeadlockDetectionTest.suite());
         suite.addTest(DeadlockModeTest.suite());
         suite.addTest(AnsiSignaturesTest.suite());
         suite.addTest(PredicatePushdownTest.suite());



Mime
View raw message