dlmarion commented on code in PR #4766:
URL: https://github.com/apache/accumulo/pull/4766#discussion_r1693588477
##########
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:
`postRestartRunningInfo` in theory could contain only a subset of the
pre-shutdown compactions. So, for the ones that existed before the shutdown,
make sure that the duration is larger. For all, make sure that they are in
progress (although this could be succeeded as well).
--
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]