SOLR-12923: Harden TestSimTriggerIntegration.

This commit is contained in:
markrmiller 2018-12-09 22:42:40 -06:00
parent 5405b2f1c3
commit 18356de837
2 changed files with 13 additions and 10 deletions

View File

@ -476,23 +476,26 @@ public class SimDistribStateManager implements DistribStateManager {
@Override @Override
public void removeData(String path, int version) throws NoSuchElementException, NotEmptyException, BadVersionException, IOException { public void removeData(String path, int version) throws NoSuchElementException, NotEmptyException, BadVersionException, IOException {
multiLock.lock(); multiLock.lock();
Node parent;
Node n;
try { try {
Node n = traverse(path, false, CreateMode.PERSISTENT); n = traverse(path, false, CreateMode.PERSISTENT);
if (n == null) { if (n == null) {
throw new NoSuchElementException(path); throw new NoSuchElementException(path);
} }
Node parent = n.parent; parent = n.parent;
if (parent == null) { if (parent == null) {
throw new IOException("Cannot remove root node"); throw new IOException("Cannot remove root node");
} }
if (!n.children.isEmpty()) { if (!n.children.isEmpty()) {
throw new NotEmptyException(path); throw new NotEmptyException(path);
} }
parent.removeChild(n.name, version);
} finally { } finally {
multiLock.unlock(); multiLock.unlock();
} }
// outside the lock to avoid deadlock with update lock
parent.removeChild(n.name, version);
} }
@Override @Override

View File

@ -210,7 +210,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
String newNode = cluster.simAddNode(); 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"); 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"); 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("The trigger did not fire at all", await);
assertTrue(triggerFired.get()); assertTrue(triggerFired.get());
NodeLostTrigger.NodeLostEvent nodeLostEvent = (NodeLostTrigger.NodeLostEvent) events.iterator().next(); 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"); 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("The trigger did not fire at all", await);
assertTrue(triggerFired.get()); assertTrue(triggerFired.get());
TriggerEvent nodeAddedEvent = events.iterator().next(); TriggerEvent nodeAddedEvent = events.iterator().next();
@ -438,7 +438,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
} }
String newNode = cluster.simAddNode(); 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("The trigger did not fire at all", await);
assertTrue(triggerFired.get()); assertTrue(triggerFired.get());
TriggerEvent nodeAddedEvent = events.iterator().next(); TriggerEvent nodeAddedEvent = events.iterator().next();
@ -726,7 +726,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
events.clear(); events.clear();
String newNode = cluster.simAddNode(); 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("The trigger did not fire at all", await);
assertTrue(triggerFired.get()); assertTrue(triggerFired.get());
// reset // 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"); fail("Trigger should have fired by now");
} }
assertEquals(1, events.size()); assertEquals(1, events.size());