You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2018/12/10 04:56:25 UTC

[3/3] lucene-solr:branch_7x: SOLR-12923: Harden TestSimTriggerIntegration.

SOLR-12923: Harden TestSimTriggerIntegration.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b62a9a0a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b62a9a0a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b62a9a0a

Branch: refs/heads/branch_7x
Commit: b62a9a0a3b8dc816230fb36a8b65b9c8bb160c00
Parents: 77bf9cd
Author: markrmiller <ma...@apache.org>
Authored: Sun Dec 9 22:42:40 2018 -0600
Committer: markrmiller <ma...@apache.org>
Committed: Sun Dec 9 22:42:40 2018 -0600

----------------------------------------------------------------------
 .../cloud/autoscaling/sim/SimDistribStateManager.java   | 11 +++++++----
 .../autoscaling/sim/TestSimTriggerIntegration.java      | 12 ++++++------
 2 files changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b62a9a0a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimDistribStateManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimDistribStateManager.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimDistribStateManager.java
index 2b8940a..7b73038 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimDistribStateManager.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimDistribStateManager.java
@@ -476,23 +476,26 @@ public class SimDistribStateManager implements DistribStateManager {
   @Override
   public void removeData(String path, int version) throws NoSuchElementException, NotEmptyException, BadVersionException, IOException {
     multiLock.lock();
+    Node parent;
+    Node n;
     try {
-      Node n = traverse(path, false, CreateMode.PERSISTENT);
+      n = traverse(path, false, CreateMode.PERSISTENT);
       if (n == null) {
         throw new NoSuchElementException(path);
       }
-      Node parent = n.parent;
+      parent = n.parent;
       if (parent == null) {
         throw new IOException("Cannot remove root node");
       }
       if (!n.children.isEmpty()) {
         throw new NotEmptyException(path);
       }
-      parent.removeChild(n.name, version);
     } finally {
       multiLock.unlock();
     }
-
+    
+    // outside the lock to avoid deadlock with update lock
+    parent.removeChild(n.name, version);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b62a9a0a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java
index 8f37ddb..c4ec122 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java
@@ -210,7 +210,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
 
     String newNode = cluster.simAddNode();
 
-    if (!triggerFiredLatch.await(45000 / SPEED, TimeUnit.MILLISECONDS)) {
+    if (!triggerFiredLatch.await(220000 / SPEED, TimeUnit.MILLISECONDS)) {
       fail("Both triggers should have fired by now");
     }
 
@@ -350,7 +350,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
       fail("Two TriggerAction instances should have been created by now");
     }
 
-    boolean await = triggerFiredLatch.await(45000 / SPEED, TimeUnit.MILLISECONDS);
+    boolean await = triggerFiredLatch.await(90000 / SPEED, TimeUnit.MILLISECONDS);
     assertTrue("The trigger did not fire at all", await);
     assertTrue(triggerFired.get());
     NodeLostTrigger.NodeLostEvent nodeLostEvent = (NodeLostTrigger.NodeLostEvent) events.iterator().next();
@@ -408,7 +408,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
       fail("Two TriggerAction instances should have been created by now");
     }
 
-    boolean await = triggerFiredLatch.await(20000 / SPEED, TimeUnit.MILLISECONDS);
+    boolean await = triggerFiredLatch.await(60000 / SPEED, TimeUnit.MILLISECONDS);
     assertTrue("The trigger did not fire at all", await);
     assertTrue(triggerFired.get());
     TriggerEvent nodeAddedEvent = events.iterator().next();
@@ -438,7 +438,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
     }
 
     String newNode = cluster.simAddNode();
-    boolean await = triggerFiredLatch.await(45000 / SPEED, TimeUnit.MILLISECONDS);
+    boolean await = triggerFiredLatch.await(60000 / SPEED, TimeUnit.MILLISECONDS);
     assertTrue("The trigger did not fire at all", await);
     assertTrue(triggerFired.get());
     TriggerEvent nodeAddedEvent = events.iterator().next();
@@ -726,7 +726,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
     events.clear();
 
     String newNode = cluster.simAddNode();
-    boolean await = triggerFiredLatch.await(60000 / SPEED, TimeUnit.MILLISECONDS);
+    boolean await = triggerFiredLatch.await(90000 / SPEED, TimeUnit.MILLISECONDS);
     assertTrue("The trigger did not fire at all", await);
     assertTrue(triggerFired.get());
     // reset
@@ -924,7 +924,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
     }
 
 
-    if (!triggerFiredLatch.await(30000 / SPEED, TimeUnit.MILLISECONDS)) {
+    if (!triggerFiredLatch.await(60000 / SPEED, TimeUnit.MILLISECONDS)) {
       fail("Trigger should have fired by now");
     }
     assertEquals(1, events.size());