psalagnac commented on code in PR #5127:
URL: https://github.com/apache/solr/pull/5127#discussion_r4280656994
##########
solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java:
##########
@@ -157,6 +157,46 @@ public void testRebalanceLeaders() throws Exception {
checkPreferredsAreLeaders();
}
+ // Sub-command async ids must be found and cleared in both Overseer and
distributed modes.
+ @Test
+ public void testRebalanceLeadersClearsAsyncIds() throws Exception {
+ DocCollection docCollection =
+
cluster.getSolrClient().getClusterState().getCollection(COLLECTION_NAME);
+ for (Slice slice : docCollection.getSlices()) {
+ Replica nonLeader =
+ slice.getReplicas().stream()
+ .filter(rep -> rep.getName().equals(slice.getLeader().getName())
== false)
+ .findFirst()
+ .orElseThrow();
+ setProp(slice, nonLeader, "preferredLeader");
+ }
+
+ int maxWaitSeconds = 30;
+ long start = System.nanoTime();
+ CollectionAdminResponse resp =
+ CollectionAdminRequest.rebalanceLeaders(COLLECTION_NAME)
+ .setMaxWaitSeconds(maxWaitSeconds)
+ .process(cluster.getSolrClient());
+ long elapsedSeconds = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() -
start);
+
assertTrue(resp.getResponse().get("Summary").toString().contains("Success"));
+
+ for (String path :
+ List.of(
+ "/distributedapi/async/persistent",
+ "/overseer/collection-map-completed",
+ "/overseer/collection-map-failure")) {
+ if (zkClient().exists(path)) {
+ List<String> leftover =
+ zkClient().getChildren(path, null).stream()
+ .filter(id -> id.startsWith("mn-rebalanceleaders_"))
Review Comment:
I'm not a fan of having magic constants like that in a test. It does
assumptions on how we store the distributed map in ZK, and the test might be
obsolete in case of some changes, without anyone one noticing it.
##########
solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java:
##########
@@ -157,6 +157,46 @@ public void testRebalanceLeaders() throws Exception {
checkPreferredsAreLeaders();
}
+ // Sub-command async ids must be found and cleared in both Overseer and
distributed modes.
+ @Test
+ public void testRebalanceLeadersClearsAsyncIds() throws Exception {
Review Comment:
This test does exactly the same assersions when running with the overseer
enabled of disabled. Since it checks these internals, it may be worth to also
have different assertions in the test.
--
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]