From d53a573cdc232baa6c58abb388b1759a5b9d096a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20Casta=C3=B1o?= Date: Wed, 25 Jan 2023 18:56:07 +0100 Subject: [PATCH] Fix SearchableSnapshotsCanMatchOnCoordinatorIntegTests Add enough documents to the searchable snapshot backing index so all shards have enough data files to be blocked during recovery. Closes #91450 --- ...ableSnapshotsCanMatchOnCoordinatorIntegTests.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java index 5cc7caccc55f3..1531ca226f2f0 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java @@ -100,10 +100,18 @@ public void testSearchableSnapshotShardsAreSkippedWithoutQueryingAnyNodeWhenThey // Either add data outside of the range, or documents that don't have timestamp data final boolean indexDataWithTimestamp = randomBoolean(); + // Add enough documents to have non-metadata segment files in all shards, + // otherwise the mount operation might go through as the read won't be + // blocked + final int numberOfDocsInIndexOutsideSearchRange = between(350, 1000); if (indexDataWithTimestamp) { - indexDocumentsWithTimestampWithinDate(indexOutsideSearchRange, between(1, 1000), "2020-11-26T%02d:%02d:%02d.%09dZ"); + indexDocumentsWithTimestampWithinDate( + indexOutsideSearchRange, + numberOfDocsInIndexOutsideSearchRange, + "2020-11-26T%02d:%02d:%02d.%09dZ" + ); } else { - indexRandomDocs(indexOutsideSearchRange, between(0, 1000)); + indexRandomDocs(indexOutsideSearchRange, numberOfDocsInIndexOutsideSearchRange); } // Index enough documents to ensure that all shards have at least some documents