keith-turner commented on code in PR #4766:
URL: https://github.com/apache/accumulo/pull/4766#discussion_r1693559561


##########
test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java:
##########
@@ -163,42 +184,34 @@ public void testCoordinatorRestartsDuringCompaction() 
throws Exception {
       Set<ExternalCompactionId> ecids =
           
waitForCompactionStartAndReturnEcids(getCluster().getServerContext(), tid);
 
+      ServerContext ctx = getCluster().getServerContext();
+
+      // Wait for all compactions to start
+      Map<ExternalCompactionId,RunningCompactionInfo> originalRunningInfo = 
null;
+      do {
+        originalRunningInfo = getRunningCompactionInformation(ctx, ecids);
+      } while (originalRunningInfo == null
+          || originalRunningInfo.values().stream().allMatch(rci -> 
rci.duration == 0));
+
       // Stop the Manager (Coordinator)
       getCluster().getClusterControl().stop(ServerType.MANAGER);
 
       // Restart the Manager while the compaction is running
       getCluster().getClusterControl().start(ServerType.MANAGER);
 
-      ServerContext ctx = getCluster().getServerContext();
+      Map<ExternalCompactionId,RunningCompactionInfo> postRestartRunningInfo =
+          getRunningCompactionInformation(ctx, ecids);
 
-      // Confirm compaction is still running
       int matches = 0;
-      while (matches == 0) {
-        TExternalCompactionList running = null;
-        while (running == null) {
-          try {
-            Optional<HostAndPort> coordinatorHost =
-                ExternalCompactionUtil.findCompactionCoordinator(ctx);
-            if (coordinatorHost.isEmpty()) {
-              throw new TTransportException(
-                  "Unable to get CompactionCoordinator address from 
ZooKeeper");
-            }
-            running = getRunningCompactions(ctx, coordinatorHost);
-          } catch (TException t) {
-            running = null;
-            Thread.sleep(2000);
-          }
-        }
-        if (running.getCompactions() != null) {
-          for (ExternalCompactionId ecid : ecids) {
-            TExternalCompaction tec = 
running.getCompactions().get(ecid.canonical());
-            if (tec != null && tec.getUpdates() != null && 
!tec.getUpdates().isEmpty()) {
-              matches++;
-              assertEquals(TCompactionState.IN_PROGRESS, getLastState(tec));
-            }
-          }
+      for (Entry<ExternalCompactionId,RunningCompactionInfo> post : 
postRestartRunningInfo
+          .entrySet()) {
+        if (originalRunningInfo.containsKey(post.getKey())) {
+          assertTrue(
+              (post.getValue().duration - 
originalRunningInfo.get(post.getKey()).duration) > 0);

Review Comment:
   Should incementing matches be moved inside the loop?  Wondering if we expect 
to always see a compaction from before restart or of that is not certain 
because of timing issues.
   
   ```suggestion
                 (post.getValue().duration - 
originalRunningInfo.get(post.getKey()).duration) > 0);
            matches++;
   ```



-- 
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]

Reply via email to