epugh commented on code in PR #4010:
URL: https://github.com/apache/solr/pull/4010#discussion_r2672737704
##########
solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java:
##########
@@ -93,78 +90,71 @@ public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
- try {
- CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1");
- List<CloudJettyRunner> otherJetties =
getOtherAvailableJetties(initialLeaderJetty);
+ CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1");
+ List<CloudJettyRunner> otherJetties =
getOtherAvailableJetties(initialLeaderJetty);
+ log.info(
+ "Leader node_name: {}, url: {}", initialLeaderJetty.coreNodeName,
initialLeaderJetty.url);
+ for (CloudJettyRunner cloudJettyRunner : otherJetties) {
log.info(
- "Leader node_name: {}, url: {}",
- initialLeaderJetty.coreNodeName,
- initialLeaderJetty.url);
- for (CloudJettyRunner cloudJettyRunner : otherJetties) {
- log.info(
- "Non-leader node_name: {}, url: {}",
- cloudJettyRunner.coreNodeName,
- cloudJettyRunner.url);
- }
+ "Non-leader node_name: {}, url: {}",
+ cloudJettyRunner.coreNodeName,
+ cloudJettyRunner.url);
+ }
- CloudJettyRunner secondNode = otherJetties.get(0);
- CloudJettyRunner freshNode = otherJetties.get(1);
+ CloudJettyRunner secondNode = otherJetties.get(0);
+ CloudJettyRunner freshNode = otherJetties.get(1);
- // shutdown a node to simulate fresh start
- otherJetties.remove(freshNode);
- forceNodeFailures(singletonList(freshNode));
+ // shutdown a node to simulate fresh start
+ otherJetties.remove(freshNode);
+ forceNodeFailures(singletonList(freshNode));
- del("*:*");
- waitForThingsToLevelOut(30, TimeUnit.SECONDS);
+ del("*:*");
+ waitForThingsToLevelOut(30, TimeUnit.SECONDS);
- checkShardConsistency(false, true);
+ checkShardConsistency(false, true);
- // index a few docs and commit
- for (int i = 0; i < 100; i++) {
- indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " +
docId++);
- }
- commit();
- waitForThingsToLevelOut(30, TimeUnit.SECONDS);
-
- checkShardConsistency(false, true);
-
- // bring down the other node and index a few docs; so the leader and
other node segments
- // diverge
- forceNodeFailures(singletonList(secondNode));
- for (int i = 0; i < 10; i++) {
- indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " +
docId++);
- if (i % 2 == 0) {
- commit();
- }
+ // index a few docs and commit
+ for (int i = 0; i < 100; i++) {
+ indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
+ }
+ commit();
+ waitForThingsToLevelOut(30, TimeUnit.SECONDS);
+
+ checkShardConsistency(false, true);
+
+ // bring down the other node and index a few docs; so the leader and other
node segments
+ // diverge
+ forceNodeFailures(singletonList(secondNode));
+ for (int i = 0; i < 10; i++) {
+ indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
+ if (i % 2 == 0) {
+ commit();
}
- commit();
- restartNodes(singletonList(secondNode));
-
- // start the freshNode
- restartNodes(singletonList(freshNode));
- String coreName =
freshNode.jetty.getCoreContainer().getCores().iterator().next().getName();
- Path replicationProperties =
- Path.of(
- freshNode.jetty.getSolrHome(), "cores", coreName, "data",
"replication.properties");
- String md5 =
DigestUtils.md5Hex(Files.readAllBytes(replicationProperties));
-
- // shutdown the original leader
- log.info("Now shutting down initial leader");
- forceNodeFailures(singletonList(initialLeaderJetty));
- waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info);
- waitTillNodesActive();
- log.info("Updating mappings from zk");
- updateMappingsFromZk(jettys, clients, true);
- assertEquals(
- "Node went into replication",
- md5,
- DigestUtils.md5Hex(Files.readAllBytes(replicationProperties)));
-
- success = true;
- } finally {
- System.clearProperty("solr.index.replication.fingerprint.enabled");
}
+ commit();
+ restartNodes(singletonList(secondNode));
+
+ // start the freshNode
+ restartNodes(singletonList(freshNode));
+ String coreName =
freshNode.jetty.getCoreContainer().getCores().iterator().next().getName();
+ Path replicationProperties =
+ Path.of(freshNode.jetty.getSolrHome(), "cores", coreName, "data",
"replication.properties");
+ String md5 = DigestUtils.md5Hex(Files.readAllBytes(replicationProperties));
+
+ // shutdown the original leader
+ log.info("Now shutting down initial leader");
+ forceNodeFailures(singletonList(initialLeaderJetty));
+ waitForNewLeader(cloudClient, "shard1", initialLeaderJetty.info);
+ waitTillNodesActive();
+ log.info("Updating mappings from zk");
+ updateMappingsFromZk(jettys, clients, true);
+ assertEquals(
+ "Node went into replication",
+ md5,
+ DigestUtils.md5Hex(Files.readAllBytes(replicationProperties)));
+
+ success = true;
Review Comment:
I *believe* that even if the test fails, our test infrastructure will reset
the `solr.index.replication.fingerprint.enabled` property.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]