Skip to content

Commit 8a779c4

Browse files
authored
Reinstate block order in testSnapshotShutdownProgressTracker (#135835) (#136014)
Partial revert of #134926
1 parent 56924e1 commit 8a779c4

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

server/src/internalClusterTest/java/org/elasticsearch/snapshots/SnapshotShutdownIT.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
494494
final var indexName = randomIdentifier();
495495
createIndexWithContent(indexName, indexSettings(numShards, 0).put(REQUIRE_NODE_NAME_SETTING, nodeForRemoval).build());
496496
indexAllShardsToAnEqualOrGreaterMinimumSize(indexName, ByteSizeValue.of(2, ByteSizeUnit.KB).getBytes());
497-
logger.info("---> nodeForRemovalId: " + nodeForRemovalId + ", numShards: " + numShards);
498497

499498
// Start the snapshot with blocking in place on the data node not to allow shard snapshots to finish yet.
500499
final var clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class);
@@ -504,21 +503,7 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
504503

505504
waitForBlock(otherNode, repoName);
506505

507-
// Block on the master when a shard snapshot request comes in, until we can verify that the Tracker saw the outgoing request.
508-
final CountDownLatch snapshotStatusUpdateLatch = new CountDownLatch(1);
509-
final var masterTransportService = MockTransportService.getInstance(internalCluster().getMasterName());
510-
masterTransportService.addRequestHandlingBehavior(
511-
TransportUpdateSnapshotStatusAction.NAME,
512-
(handler, request, channel, task) -> masterTransportService.getThreadPool().generic().execute(() -> {
513-
safeAwait(snapshotStatusUpdateLatch);
514-
try {
515-
handler.messageReceived(request, channel, task);
516-
} catch (Exception e) {
517-
fail(e);
518-
}
519-
})
520-
);
521-
506+
logger.info("---> nodeForRemovalId: " + nodeForRemovalId + ", numShards: " + numShards);
522507
mockLog.addExpectation(
523508
new MockLog.SeenEventExpectation(
524509
"SnapshotShutdownProgressTracker start log message",
@@ -566,6 +551,21 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
566551
mockLog.awaitAllExpectationsMatched();
567552
resetMockLog();
568553

554+
// Block on the master when a shard snapshot request comes in, until we can verify that the Tracker saw the outgoing request.
555+
final CountDownLatch snapshotStatusUpdateLatch = new CountDownLatch(1);
556+
final var masterTransportService = MockTransportService.getInstance(internalCluster().getMasterName());
557+
masterTransportService.addRequestHandlingBehavior(
558+
TransportUpdateSnapshotStatusAction.NAME,
559+
(handler, request, channel, task) -> masterTransportService.getThreadPool().generic().execute(() -> {
560+
safeAwait(snapshotStatusUpdateLatch);
561+
try {
562+
handler.messageReceived(request, channel, task);
563+
} catch (Exception e) {
564+
fail(e);
565+
}
566+
})
567+
);
568+
569569
mockLog.addExpectation(
570570
new MockLog.SeenEventExpectation(
571571
"SnapshotShutdownProgressTracker shard snapshot has paused log message",

0 commit comments

Comments
 (0)