mirror of https://github.com/apache/lucene.git
SOLR-11407: Add more logging to this test to discover the reason for failures.
This commit is contained in:
parent
94aa188684
commit
5e69a465ee
|
@ -183,12 +183,15 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
cluster.getSolrClient().getZkStateReader().registerCore(".system");
|
||||
cluster.getSolrClient().getZkStateReader().registerCore(PREFIX + "_collection");
|
||||
|
||||
log.info("### Start add node...");
|
||||
JettySolrRunner jetty = cluster.startJettySolrRunner();
|
||||
String nodeAddedName = jetty.getNodeName();
|
||||
log.info("### Added node " + nodeAddedName);
|
||||
boolean await = actionFiredLatch.await(60, TimeUnit.SECONDS);
|
||||
assertTrue("action did not execute", await);
|
||||
// commit on the history collection
|
||||
Thread.sleep(2000);
|
||||
log.info("### Commit .system");
|
||||
solrClient.commit(CollectionAdminParams.SYSTEM_COLL);
|
||||
Thread.sleep(2000);
|
||||
// verify that new docs exist
|
||||
|
@ -249,12 +252,18 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
resetLatch();
|
||||
|
||||
// kill a node
|
||||
String node0Name = cluster.getJettySolrRunner(0).getNodeName();
|
||||
log.info("### Stopping node " + node0Name);
|
||||
cluster.stopJettySolrRunner(0);
|
||||
log.info("### Stopped node " + node0Name);
|
||||
await = actionFiredLatch.await(60, TimeUnit.SECONDS);
|
||||
assertTrue("action did not execute", await);
|
||||
|
||||
// wait for recovery
|
||||
waitForRecovery(PREFIX + "_collection");
|
||||
Thread.sleep(5000);
|
||||
// commit on the history collection
|
||||
log.info("### Commit .system");
|
||||
solrClient.commit(CollectionAdminParams.SYSTEM_COLL);
|
||||
query = params(CommonParams.QT, CommonParams.AUTOSCALING_HISTORY_PATH,
|
||||
AutoscalingHistoryHandler.TRIGGER_PARAM, PREFIX + "_node_lost_trigger");
|
||||
|
@ -269,19 +278,27 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
private void waitForRecovery(String collection) throws Exception {
|
||||
log.info("Waiting for recovery of " + collection);
|
||||
boolean recovered = false;
|
||||
boolean allActive = true;
|
||||
boolean hasLeaders = true;
|
||||
DocCollection collState = null;
|
||||
for (int i = 0; i < 300; i++) {
|
||||
ClusterState state = solrClient.getZkStateReader().getClusterState();
|
||||
DocCollection collState = getCollectionState(collection);
|
||||
collState = getCollectionState(collection);
|
||||
log.debug("###### " + collState);
|
||||
Collection<Replica> replicas = collState.getReplicas();
|
||||
boolean allActive = true;
|
||||
boolean hasLeaders = true;
|
||||
allActive = true;
|
||||
hasLeaders = true;
|
||||
if (replicas != null && !replicas.isEmpty()) {
|
||||
for (Replica r : replicas) {
|
||||
if (!r.isActive(state.getLiveNodes())) {
|
||||
log.info("Not active: " + r);
|
||||
allActive = false;
|
||||
if (state.getLiveNodes().contains(r.getNodeName())) {
|
||||
if (!r.isActive(state.getLiveNodes())) {
|
||||
log.info("Not active: " + r);
|
||||
allActive = false;
|
||||
}
|
||||
} else {
|
||||
log.info("Replica no longer on a live node, ignoring: " + r);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -300,7 +317,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
assertTrue("replica never fully recovered", recovered);
|
||||
assertTrue("replica never fully recovered: allActive=" + allActive + ", hasLeaders=" + hasLeaders + ", collState=" + collState, recovered);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue