SOLR-12923: Harden TestSimLargeCluster.

This commit is contained in:
markrmiller 2018-12-10 09:39:42 -06:00
parent bf0e9b367a
commit 202dad8c88
3 changed files with 13 additions and 16 deletions

View File

@ -889,6 +889,7 @@ public class SimCloudManager implements SolrCloudManager {
IOUtils.closeQuietly(stateManager); IOUtils.closeQuietly(stateManager);
triggerThread.interrupt(); triggerThread.interrupt();
IOUtils.closeQuietly(triggerThread); IOUtils.closeQuietly(triggerThread);
triggerThread.interrupt();
try { try {
triggerThread.join(); triggerThread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -1369,7 +1369,7 @@ public class SimClusterStateProvider implements ClusterStateProvider {
OverseerCollectionMessageHandler.NUM_SLICES, "1", OverseerCollectionMessageHandler.NUM_SLICES, "1",
CommonAdminParams.WAIT_FOR_FINAL_STATE, "true"); CommonAdminParams.WAIT_FOR_FINAL_STATE, "true");
simCreateCollection(props, new NamedList()); simCreateCollection(props, new NamedList());
CloudTestUtils.waitForState(cloudManager, CollectionAdminParams.SYSTEM_COLL, 90, TimeUnit.SECONDS, CloudTestUtils.waitForState(cloudManager, CollectionAdminParams.SYSTEM_COLL, 120, TimeUnit.SECONDS,
CloudTestUtils.clusterShape(1, Integer.parseInt(repFactor), false, true)); CloudTestUtils.clusterShape(1, Integer.parseInt(repFactor), false, true));
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);

View File

@ -53,7 +53,6 @@ import org.apache.solr.cloud.autoscaling.TriggerListenerBase;
import org.apache.solr.cloud.autoscaling.TriggerValidationException; import org.apache.solr.cloud.autoscaling.TriggerValidationException;
import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.Replica; import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.params.CollectionAdminParams;
import org.apache.solr.common.params.CollectionParams; import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.Pair; import org.apache.solr.common.util.Pair;
@ -133,12 +132,6 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
} }
} }
// do this in advance if missing
if (!cluster.getSimClusterStateProvider().simListCollections().contains(CollectionAdminParams.SYSTEM_COLL)) {
cluster.getSimClusterStateProvider().createSystemCollection();
CloudTestUtils.waitForState(cluster, CollectionAdminParams.SYSTEM_COLL, 120, TimeUnit.SECONDS,
CloudTestUtils.clusterShape(1, 3, false, true));
}
} }
public static class TestTriggerListener extends TriggerListenerBase { public static class TestTriggerListener extends TriggerListenerBase {
@ -310,7 +303,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
create.setAutoAddReplicas(false); create.setAutoAddReplicas(false);
create.process(solrClient); create.process(solrClient);
log.info("Ready after " + CloudTestUtils.waitForState(cluster, collectionName, 20 * NUM_NODES, TimeUnit.SECONDS, log.info("Ready after " + CloudTestUtils.waitForState(cluster, collectionName, 90 * NUM_NODES, TimeUnit.SECONDS,
CloudTestUtils.clusterShape(NUM_NODES / 10, NUM_NODES / 8 * 3, false, true)) + " ms"); CloudTestUtils.clusterShape(NUM_NODES / 10, NUM_NODES / 8 * 3, false, true)) + " ms");
// start adding nodes // start adding nodes
@ -325,7 +318,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
assertTrue("trigger did not fire", await); assertTrue("trigger did not fire", await);
// wait until started == finished // wait until started == finished
TimeOut timeOut = new TimeOut(20 * waitForSeconds * NUM_NODES, TimeUnit.SECONDS, cluster.getTimeSource()); TimeOut timeOut = new TimeOut(45 * waitForSeconds * NUM_NODES, TimeUnit.SECONDS, cluster.getTimeSource());
while (!timeOut.hasTimedOut()) { while (!timeOut.hasTimedOut()) {
if (triggerStartedCount.get() == triggerFinishedCount.get()) { if (triggerStartedCount.get() == triggerFinishedCount.get()) {
break; break;
@ -510,7 +503,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
create.setAutoAddReplicas(false); create.setAutoAddReplicas(false);
create.process(solrClient); create.process(solrClient);
log.info("Ready after " + CloudTestUtils.waitForState(cluster, collectionName, 30 * NUM_NODES, TimeUnit.SECONDS, log.info("Ready after " + CloudTestUtils.waitForState(cluster, collectionName, 60 * NUM_NODES, TimeUnit.SECONDS,
CloudTestUtils.clusterShape(NUM_NODES / 5, NUM_NODES / 10, false, true)) + " ms"); CloudTestUtils.clusterShape(NUM_NODES / 5, NUM_NODES / 10, false, true)) + " ms");
// start killing nodes // start killing nodes
@ -701,12 +694,15 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
assertEquals(response.get("result").toString(), "success"); assertEquals(response.get("result").toString(), "success");
boolean await = triggerFinishedLatch.await(waitForSeconds * 20000 / SPEED, TimeUnit.MILLISECONDS); boolean await = triggerFinishedLatch.await(waitForSeconds * 45000 / SPEED, TimeUnit.MILLISECONDS);
assertTrue("The trigger did not fire at all", await); assertTrue("The trigger did not fire at all", await);
// wait for listener to capture the SUCCEEDED stage // wait for listener to capture the SUCCEEDED stage
cluster.getTimeSource().sleep(5000); cluster.getTimeSource().sleep(15000);
assertNotNull(listenerEvents.toString(), listenerEvents.get("srt"));
assertEquals(listenerEvents.toString(), 1, listenerEvents.get("srt").size()); assertNotNull(listenerEvents.entrySet().toString(), listenerEvents.get("srt"));
assertTrue(listenerEvents.toString(), listenerEvents.get("srt").size() >= 1);
CapturedEvent ev = listenerEvents.get("srt").get(0); CapturedEvent ev = listenerEvents.get("srt").get(0);
assertEquals(TriggerEventType.SEARCHRATE, ev.event.getEventType()); assertEquals(TriggerEventType.SEARCHRATE, ev.event.getEventType());
Map<String, Number> m = (Map<String, Number>)ev.event.getProperty(SearchRateTrigger.HOT_NODES); Map<String, Number> m = (Map<String, Number>)ev.event.getProperty(SearchRateTrigger.HOT_NODES);