Skip to content

Commit ea55cc6

Browse files
authored
Fix testILMDownsampleRollingRestart() test (#98889) (#99267)
Check that source index exists prior to updating index.lifecycle.name index setting. Relates #98764
1 parent 2c8e6e8 commit ea55cc6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/ILMDownsampleDisruptionIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,14 @@ private void startDownsampleTaskViaIlm(
210210
var request = new UpdateSettingsRequest(sourceIndex).settings(
211211
Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, POLICY_NAME)
212212
);
213+
// Updating index.lifecycle.name setting may fail due to the rolling restart itself,
214+
// we need to attempt it in a assertBusy(...)
213215
assertBusy(() -> {
214216
try {
217+
if (indexExists(sourceIndex) == false) {
218+
logger.info("The source index [{}] no longer exists, downsampling likely completed", sourceIndex);
219+
return;
220+
}
215221
client().admin().indices().updateSettings(request).actionGet(TimeValue.timeValueSeconds(10));
216222
} catch (Exception e) {
217223
logger.warn(() -> format("encountered failure while updating [%s] index's ilm policy", sourceIndex), e);

0 commit comments

Comments
 (0)