Skip to content

Commit

Permalink
Avoid rolling over twice in searchable snapshot test (#108790)
Browse files Browse the repository at this point in the history
Manually rolling over the data stream was 1. not necessary, and
2. causing issues when it happened after ILM had already rolled
over, which would make ILM convert the second backing index into a
searchable snapshot as well, possibly preventing the data stream
from being deleted.
  • Loading branch information
nielsbauman committed May 23, 2024
1 parent 61ca45b commit 1073c8b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,16 @@ public void testSearchableSnapshotsInHotPhasePinnedToHotNodes() throws Exception
)
);

indexDocument(client(), dataStream, true);
String firstGenIndex = DataStream.getDefaultBackingIndexName(dataStream, 1L);
// Create the data stream.
assertOK(client().performRequest(new Request("PUT", "_data_stream/" + dataStream)));

var backingIndices = getBackingIndices(client(), dataStream);
String firstGenIndex = backingIndices.get(0);
Map<String, Object> indexSettings = getIndexSettingsAsMap(firstGenIndex);
assertThat(indexSettings.get(DataTier.TIER_PREFERENCE), is("data_hot"));

// rollover the data stream so searchable_snapshot can complete
rolloverMaxOneDocCondition(client(), dataStream);
indexDocument(client(), dataStream, true);

final String restoredIndex = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + firstGenIndex;
assertBusy(() -> {
Expand Down

0 comments on commit 1073c8b

Please sign in to comment.