Skip to content

Commit b911672

Browse files
Ke Lijasontedor
Ke Li
authored andcommitted
Deprecate setting index.optimize_auto_generated_id (#28862)
1 parent a332411 commit b911672

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public final class EngineConfig {
109109
* The default is <code>true</code>
110110
*/
111111
public static final Setting<Boolean> INDEX_OPTIMIZE_AUTO_GENERATED_IDS = Setting.boolSetting("index.optimize_auto_generated_id", true,
112-
Property.IndexScope, Property.Dynamic);
112+
Property.IndexScope, Property.Dynamic, Property.Deprecated);
113113

114114
private final TranslogConfig translogConfig;
115115

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.index.engine;
20+
21+
import org.elasticsearch.Version;
22+
import org.elasticsearch.cluster.metadata.IndexMetaData;
23+
import org.elasticsearch.common.settings.Setting;
24+
import org.elasticsearch.common.settings.Settings;
25+
import org.elasticsearch.index.IndexSettings;
26+
import org.elasticsearch.test.ESTestCase;
27+
import org.elasticsearch.test.IndexSettingsModule;
28+
29+
30+
public class EngineConfigTests extends ESTestCase {
31+
32+
public void testOptimizeAutoGeneratedIdsSettingDeprecation() {
33+
boolean optimizeAutoGeneratedIds = randomBoolean();
34+
Settings.Builder builder = Settings.builder()
35+
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
36+
.put(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey(), optimizeAutoGeneratedIds);
37+
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("index1", builder.build());
38+
39+
EngineConfig config = new EngineConfig(null, null, null,
40+
indexSettings, null, null, null, null,
41+
null, null, null, null, null,
42+
null, null, null, null, null, null,
43+
null, null, null);
44+
45+
assertEquals(optimizeAutoGeneratedIds, config.isAutoGeneratedIDsOptimizationEnabled());
46+
assertSettingDeprecationsAndWarnings(new Setting<?>[]{EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS});
47+
}
48+
49+
}

0 commit comments

Comments
 (0)