Skip to content

Commit 5a58c9e

Browse files
Likejasontedor
authored andcommitted
Remove setting index.optimize_auto_generated_id (#27600)
1 parent 1242592 commit 5a58c9e

File tree

6 files changed

+0
-80
lines changed

6 files changed

+0
-80
lines changed

server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
159159
IndexModule.INDEX_QUERY_CACHE_ENABLED_SETTING,
160160
FsDirectoryService.INDEX_LOCK_FACTOR_SETTING,
161161
EngineConfig.INDEX_CODEC_SETTING,
162-
EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS,
163162
IndexMetaData.SETTING_WAIT_FOR_ACTIVE_SHARDS,
164163
IndexSettings.DEFAULT_PIPELINE,
165164

server/src/main/java/org/elasticsearch/index/engine/EngineConfig.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
116116
}
117117
}, Property.IndexScope, Property.NodeScope);
118118

119-
/**
120-
* Configures an index to optimize documents with auto generated ids for append only. If this setting is updated from <code>false</code>
121-
* to <code>true</code> might not take effect immediately. In other words, disabling the optimization will be immediately applied while
122-
* re-enabling it might not be applied until the engine is in a safe state to do so. Depending on the engine implementation a change to
123-
* this setting won't be reflected re-enabled optimization until the engine is restarted or the index is closed and reopened.
124-
* The default is <code>true</code>
125-
*/
126-
public static final Setting<Boolean> INDEX_OPTIMIZE_AUTO_GENERATED_IDS = Setting.boolSetting("index.optimize_auto_generated_id", true,
127-
Property.IndexScope, Property.Dynamic);
128-
129119
private final TranslogConfig translogConfig;
130120

131121
/**
@@ -349,14 +339,6 @@ public List<ReferenceManager.RefreshListener> getExternalRefreshListener() {
349339
*/
350340
public List<ReferenceManager.RefreshListener> getInternalRefreshListener() { return internalRefreshListener;}
351341

352-
353-
/**
354-
* returns true if the engine is allowed to optimize indexing operations with an auto-generated ID
355-
*/
356-
public boolean isAutoGeneratedIDsOptimizationEnabled() {
357-
return indexSettings.getValue(INDEX_OPTIMIZE_AUTO_GENERATED_IDS);
358-
}
359-
360342
/**
361343
* Return the sort order of this index, or null if the index has no sort.
362344
*/

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ public InternalEngine(EngineConfig engineConfig) {
171171
final EngineConfig engineConfig,
172172
final BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) {
173173
super(engineConfig);
174-
if (engineConfig.isAutoGeneratedIDsOptimizationEnabled() == false) {
175-
updateAutoIdTimestamp(Long.MAX_VALUE, true);
176-
}
177174
final TranslogDeletionPolicy translogDeletionPolicy = new TranslogDeletionPolicy(
178175
engineConfig.getIndexSettings().getTranslogRetentionSize().getBytes(),
179176
engineConfig.getIndexSettings().getTranslogRetentionAge().getMillis()
@@ -2400,12 +2397,6 @@ public void onSettingsChanged() {
24002397
mergeScheduler.refreshConfig();
24012398
// config().isEnableGcDeletes() or config.getGcDeletesInMillis() may have changed:
24022399
maybePruneDeletes();
2403-
if (engineConfig.isAutoGeneratedIDsOptimizationEnabled() == false) {
2404-
// this is an anti-viral settings you can only opt out for the entire index
2405-
// only if a shard starts up again due to relocation or if the index is closed
2406-
// the setting will be re-interpreted if it's set to true
2407-
updateAutoIdTimestamp(Long.MAX_VALUE, true);
2408-
}
24092400
final TranslogDeletionPolicy translogDeletionPolicy = translog.getDeletionPolicy();
24102401
final IndexSettings indexSettings = engineConfig.getIndexSettings();
24112402
translogDeletionPolicy.setRetentionAgeInMillis(indexSettings.getTranslogRetentionAge().getMillis());

server/src/main/java/org/elasticsearch/indices/IndicesService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
import org.elasticsearch.index.analysis.AnalysisRegistry;
8484
import org.elasticsearch.index.cache.request.ShardRequestCache;
8585
import org.elasticsearch.index.engine.CommitStats;
86-
import org.elasticsearch.index.engine.EngineConfig;
8786
import org.elasticsearch.index.engine.EngineFactory;
8887
import org.elasticsearch.index.engine.InternalEngineFactory;
8988
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
@@ -494,11 +493,6 @@ private synchronized IndexService createIndexService(final String reason,
494493
List<IndexEventListener> builtInListeners,
495494
IndexingOperationListener... indexingOperationListeners) throws IOException {
496495
final IndexSettings idxSettings = new IndexSettings(indexMetaData, settings, indexScopedSettings);
497-
if (idxSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)
498-
&& EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.exists(idxSettings.getSettings())) {
499-
throw new IllegalArgumentException(
500-
"Setting [" + EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey() + "] was removed in version 7.0.0");
501-
}
502496
// we ignore private settings since they are not registered settings
503497
indexScopedSettings.validate(indexMetaData.getSettings(), true, true, true);
504498
logger.debug("creating Index [{}], shards [{}]/[{}] - reason [{}]",

server/src/test/java/org/elasticsearch/indices/IndicesServiceTests.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -642,48 +642,4 @@ public static ClusterState createClusterForShardLimitTest(int nodesInCluster, in
642642
.build();
643643
}
644644

645-
public void testOptimizeAutoGeneratedIdsSettingRemoval() throws Exception {
646-
final IndicesService indicesService = getIndicesService();
647-
648-
final Index index = new Index("foo-index", UUIDs.randomBase64UUID());
649-
Settings.Builder builder = Settings.builder()
650-
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_7_0_0)
651-
.put(IndexMetaData.SETTING_INDEX_UUID, index.getUUID());
652-
IndexMetaData indexMetaData = new IndexMetaData.Builder(index.getName())
653-
.settings(builder.build())
654-
.numberOfShards(1)
655-
.numberOfReplicas(0)
656-
.build();
657-
IndexService indexService = indicesService.createIndex(indexMetaData, Collections.emptyList());
658-
assertNotNull(indexService);
659-
660-
final Index index2 = new Index("bar-index", UUIDs.randomBase64UUID());
661-
Settings.Builder builder2 = Settings.builder()
662-
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_7_0_0)
663-
.put(IndexMetaData.SETTING_INDEX_UUID, index2.getUUID())
664-
.put(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey(), randomBoolean());
665-
IndexMetaData indexMetaData2 = new IndexMetaData.Builder(index2.getName())
666-
.settings(builder2.build())
667-
.numberOfShards(1)
668-
.numberOfReplicas(0)
669-
.build();
670-
IllegalArgumentException ex = expectThrows(IllegalArgumentException.class,
671-
() -> indicesService.createIndex(indexMetaData2, Collections.emptyList()));
672-
assertEquals("Setting [" + EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey() + "] was removed in version 7.0.0",
673-
ex.getMessage());
674-
675-
Version version = randomFrom(Version.V_6_0_0_rc1, Version.V_6_0_0, Version.V_6_2_0, Version.V_6_3_0, Version.V_6_4_0);
676-
builder = Settings.builder()
677-
.put(IndexMetaData.SETTING_VERSION_CREATED, version)
678-
.put(IndexMetaData.SETTING_INDEX_UUID, index2.getUUID())
679-
.put(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey(), randomBoolean());
680-
IndexMetaData indexMetaData3 = new IndexMetaData.Builder(index2.getName())
681-
.settings(builder.build())
682-
.numberOfShards(1)
683-
.numberOfReplicas(0)
684-
.build();
685-
IndexService indexService2 = indicesService.createIndex(indexMetaData3, Collections.emptyList());
686-
assertNotNull(indexService2);
687-
}
688-
689645
}

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/TransportResumeFollowActionTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.elasticsearch.common.settings.Settings;
1515
import org.elasticsearch.index.IndexSettings;
1616
import org.elasticsearch.index.MapperTestUtils;
17-
import org.elasticsearch.index.engine.EngineConfig;
1817
import org.elasticsearch.index.mapper.MapperService;
1918
import org.elasticsearch.test.ESTestCase;
2019
import org.elasticsearch.test.VersionUtils;
@@ -233,7 +232,6 @@ public void testDynamicIndexSettingsAreClassified() {
233232
replicatedSettings.add(MapperService.INDEX_MAPPER_DYNAMIC_SETTING);
234233
replicatedSettings.add(IndexSettings.MAX_NGRAM_DIFF_SETTING);
235234
replicatedSettings.add(IndexSettings.MAX_SHINGLE_DIFF_SETTING);
236-
replicatedSettings.add(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS);
237235

238236
for (Setting<?> setting : IndexScopedSettings.BUILT_IN_INDEX_SETTINGS) {
239237
if (setting.isDynamic()) {

0 commit comments

Comments
 (0)