From f96c7272289b18e9780cad66621f042d4e9d7bf1 Mon Sep 17 00:00:00 2001 From: Dianna Hohensee Date: Mon, 28 Jul 2025 18:13:58 -0400 Subject: [PATCH] Fix testCloseOrReallocateDuringPartialSnapshot There's a race between setting a shard as failed and a concurrent non-partial snapshot, resulting in a snapshot failure because a primary shard is not available for backup. Since the intention of the test is to verify shard close/failc can proceed while a snapshot is in progress, there's no need for this extra randomization. Closes #131900 --- .../snapshots/SharedClusterSnapshotRestoreIT.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index 5615e53ddcc29..dbb571513aeb2 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -1447,12 +1447,11 @@ public void run() { safeAwait(barrier); final var snapshotName = randomIdentifier(); - final var partialSnapshot = randomBoolean(); ActionFuture snapshotFuture = clusterAdmin().prepareCreateSnapshot( TEST_REQUEST_TIMEOUT, repoName, snapshotName - ).setIndices(indexName).setWaitForCompletion(true).setPartial(partialSnapshot).execute(); + ).setIndices(indexName).setWaitForCompletion(true).setPartial(true).execute(); // we have currently blocked the start-snapshot task from running, and it will be followed by at least three blob uploads // (segments_N, .cfe, .cfs), executed one-at-a-time because of throttling to the max threadpool size, so it's safe to let up to @@ -1466,7 +1465,7 @@ public void run() { assertFalse(snapshotFuture.isDone()); try { - if (partialSnapshot && randomBoolean()) { + if (randomBoolean()) { logger.info("--> closing index [{}]", indexName); safeGet(indicesAdmin().prepareClose(indexName).execute()); ensureGreen(indexName);