Skip to content

Commit 9d44a24

Browse files
committed
Reinstate block order in testSnapshotShutdownProgressTracker
Partial revert of elastic#134926 Backport of elastic#135835 to 9.1
1 parent 230625c commit 9d44a24

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
@@ -499,7 +499,6 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
499499
final var indexName = randomIdentifier();
500500
createIndexWithContent(indexName, indexSettings(numShards, 0).put(REQUIRE_NODE_NAME_SETTING, nodeForRemoval).build());
501501
indexAllShardsToAnEqualOrGreaterMinimumSize(indexName, ByteSizeValue.of(2, ByteSizeUnit.KB).getBytes());
502-
logger.info("---> nodeForRemovalId: " + nodeForRemovalId + ", numShards: " + numShards);
503502

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

510509
waitForBlock(otherNode, repoName);
511510

512-
// Block on the master when a shard snapshot request comes in, until we can verify that the Tracker saw the outgoing request.
513-
final CountDownLatch snapshotStatusUpdateLatch = new CountDownLatch(1);
514-
final var masterTransportService = MockTransportService.getInstance(internalCluster().getMasterName());
515-
masterTransportService.addRequestHandlingBehavior(
516-
SnapshotsService.UPDATE_SNAPSHOT_STATUS_ACTION_NAME,
517-
(handler, request, channel, task) -> masterTransportService.getThreadPool().generic().execute(() -> {
518-
safeAwait(snapshotStatusUpdateLatch);
519-
try {
520-
handler.messageReceived(request, channel, task);
521-
} catch (Exception e) {
522-
fail(e);
523-
}
524-
})
525-
);
526-
511+
logger.info("---> nodeForRemovalId: " + nodeForRemovalId + ", numShards: " + numShards);
527512
mockLog.addExpectation(
528513
new MockLog.SeenEventExpectation(
529514
"SnapshotShutdownProgressTracker start log message",
@@ -571,6 +556,21 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
571556
mockLog.awaitAllExpectationsMatched();
572557
resetMockLog();
573558

559+
// Block on the master when a shard snapshot request comes in, until we can verify that the Tracker saw the outgoing request.
560+
final CountDownLatch snapshotStatusUpdateLatch = new CountDownLatch(1);
561+
final var masterTransportService = MockTransportService.getInstance(internalCluster().getMasterName());
562+
masterTransportService.addRequestHandlingBehavior(
563+
SnapshotsService.UPDATE_SNAPSHOT_STATUS_ACTION_NAME,
564+
(handler, request, channel, task) -> masterTransportService.getThreadPool().generic().execute(() -> {
565+
safeAwait(snapshotStatusUpdateLatch);
566+
try {
567+
handler.messageReceived(request, channel, task);
568+
} catch (Exception e) {
569+
fail(e);
570+
}
571+
})
572+
);
573+
574574
mockLog.addExpectation(
575575
new MockLog.SeenEventExpectation(
576576
"SnapshotShutdownProgressTracker shard snapshot has paused log message",

0 commit comments

Comments
 (0)