Skip to content

Commit 5f59c1c

Browse files
authored
[TSDB] Exclude index.block.write setting when creating rollup index (#88812)
PR #88565 modified the rollup action so that it copies all index settings from the source to the rollup index. However, the rollup action expilitly requires that the source index has the index.block.write: true. Since the rollup index must be writeable when it is created, this PR excludes the index.block.write i ndex setting when creating the rollup index. The index.block.write index setting is explictly set to true at the end of the rollup action (step 4).
1 parent a622864 commit 5f59c1c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/TransportRollupAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,10 @@ private IndexMetadata.Builder copyIndexMetadata(IndexMetadata sourceIndexMetadat
483483
// the same rules with resize apply
484484
continue;
485485
}
486-
// do not override settings that have already been set in the rollup index
487-
if (targetSettings.keys().contains(key)) {
486+
// Do not override settings that have already been set in the rollup index.
487+
// Also, we don't want to copy the `index.block.write` setting that we know
488+
// it is set in the source index settings.
489+
if (IndexMetadata.SETTING_BLOCKS_WRITE.equals(key) || targetSettings.keys().contains(key)) {
488490
continue;
489491
}
490492
targetSettings.copy(key, sourceIndexMetadata.getSettings());

x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/v2/RollupActionSingleNodeTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ public void testCopyIndexSettings() throws IOException {
302302
prepareSourceIndex(sourceIndex);
303303
rollup(sourceIndex, rollupIndex, config);
304304

305-
GetIndexResponse indexSettingsResp = client().admin().indices().prepareGetIndex().addIndices(rollupIndex).get();
305+
GetIndexResponse indexSettingsResp = client().admin().indices().prepareGetIndex().addIndices(sourceIndex, rollupIndex).get();
306+
assertRollupIndexSettings(sourceIndex, rollupIndex, indexSettingsResp);
306307
for (String key : settings.keySet()) {
307308
assertEquals(settings.get(key), indexSettingsResp.getSetting(rollupIndex, key));
308309
}

0 commit comments

Comments
 (0)