Skip to content

[8.19] Fix assertion in DiskThresholdDeciderIT (#127615) #127643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix assertion in DiskThresholdDeciderIT (#127615)
The test launches two concurrent restores and wants to verify that
the node with limited disk space is only assigned a single shard from
one of the indices.  The test was asserting that it had one shard from
the first index, but it is possible for it to get one shard from the
index copy instead.  This change allows the shard to be from either
index, but still asserts there is only one assignment to the tiny node.

Closes #127286

(cherry picked from commit 6263f44)

# Conflicts:
#	muted-tests.yml
  • Loading branch information
JeremyDahlgren committed May 2, 2025
commit 385629f4737e3fff6dfbec3a2de412df6cd03d2a
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,6 @@ tests:
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
method: testLookUpSearchContext
issue: https://github.com/elastic/elasticsearch/issues/126813
- class: org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDeciderIT
method: testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleRestores
issue: https://github.com/elastic/elasticsearch/issues/127286
- class: org.elasticsearch.test.index.IndexVersionUtilsTests
method: testIndexCompatibleVersionMatches
issue: https://github.com/elastic/elasticsearch/issues/120760
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.in;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
Expand Down Expand Up @@ -242,7 +241,7 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleResto
clusterAdmin().prepareRestoreSnapshot(TEST_REQUEST_TIMEOUT, "repo", "snap")
.setWaitForCompletion(true)
.setRenamePattern(indexName)
.setRenameReplacement(indexName + "-copy")
.setRenameReplacement(copyIndexName)
.execute(ActionTestUtils.assertNoFailureListener(restoreSnapshotResponse -> {
final RestoreInfo restoreInfo = restoreSnapshotResponse.getRestoreInfo();
assertThat(restoreInfo.successfulShards(), is(snapshotInfo.totalShards()));
Expand All @@ -268,10 +267,19 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleResto

// wait for all the shards to finish moving
safeAwait(allShardsActiveListener);
ensureGreen(indexName, indexName + "-copy");
ensureGreen(indexName, copyIndexName);

final var tinyNodeShardIds = getShardIds(dataNodeId, indexName);
assertThat(tinyNodeShardIds, hasSize(1));
final var tinyNodeShardIdsCopy = getShardIds(dataNodeId, copyIndexName);
assertThat(
"expected just one shard from one index on the tiny node, instead got "
+ tinyNodeShardIds
+ " from the original index and "
+ tinyNodeShardIdsCopy
+ " from the copy",
tinyNodeShardIds.size() + tinyNodeShardIdsCopy.size(),
is(1)
);
assertThat(tinyNodeShardIds.iterator().next(), in(shardSizes.getShardIdsWithSizeSmallerOrEqual(usableSpace)));
}

Expand Down