Skip to content

Commit 1a088ef

Browse files
committed
comment
1 parent 8cecdaa commit 1a088ef

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/action/ReindexDataStreamIndexTransportAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ private void createIndex(
254254
var settingsOverride = Settings.builder()
255255
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
256256
.put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), -1)
257+
// remove lifecycle so that ILM does not start processing before the index is added to data stream
257258
.putNull(IndexMetadata.LIFECYCLE_NAME)
258259
.build();
259260

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/task/ReindexDataStreamPersistentTaskExecutor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ private void updateDataStream(
251251
client.execute(ModifyDataStreamsAction.INSTANCE, modifyDataStreamRequest, listener.map(ingored -> newIndex));
252252
}
253253

254+
/**
255+
* Copy lifecycle name from the old index to the new index, so that ILM can now process the new index.
256+
* If the new index has a lifecycle name before it is swapped into the data stream, ILM will try, and fail, to process
257+
* the new index. For this reason, lifecycle is not set until after the new index has been added to the data stream.
258+
*/
254259
private void copySettings(String oldIndex, String newIndex, ActionListener<AcknowledgedResponse> listener, TaskId parentTaskId) {
255260
var getSettingsRequest = new GetSettingsRequest(TimeValue.MAX_VALUE).indices(oldIndex);
256261
getSettingsRequest.setParentTask(parentTaskId);

0 commit comments

Comments
 (0)