Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove setting index.optimize_auto_generated_id (#27583) #27600

Merged
merged 3 commits into from
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
IndexModule.INDEX_QUERY_CACHE_ENABLED_SETTING,
FsDirectoryService.INDEX_LOCK_FACTOR_SETTING,
EngineConfig.INDEX_CODEC_SETTING,
EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS,
IndexMetaData.SETTING_WAIT_FOR_ACTIVE_SHARDS,
IndexSettings.DEFAULT_PIPELINE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
}
}, Property.IndexScope, Property.NodeScope);

/**
* Configures an index to optimize documents with auto generated ids for append only. If this setting is updated from <code>false</code>
* to <code>true</code> might not take effect immediately. In other words, disabling the optimization will be immediately applied while
* 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
* this setting won't be reflected re-enabled optimization until the engine is restarted or the index is closed and reopened.
* The default is <code>true</code>
*/
public static final Setting<Boolean> INDEX_OPTIMIZE_AUTO_GENERATED_IDS = Setting.boolSetting("index.optimize_auto_generated_id", true,
Property.IndexScope, Property.Dynamic);

private final TranslogConfig translogConfig;

/**
Expand Down Expand Up @@ -349,14 +339,6 @@ public List<ReferenceManager.RefreshListener> getExternalRefreshListener() {
*/
public List<ReferenceManager.RefreshListener> getInternalRefreshListener() { return internalRefreshListener;}


/**
* returns true if the engine is allowed to optimize indexing operations with an auto-generated ID
*/
public boolean isAutoGeneratedIDsOptimizationEnabled() {
return indexSettings.getValue(INDEX_OPTIMIZE_AUTO_GENERATED_IDS);
}

/**
* Return the sort order of this index, or null if the index has no sort.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ public InternalEngine(EngineConfig engineConfig) {
final EngineConfig engineConfig,
final BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) {
super(engineConfig);
if (engineConfig.isAutoGeneratedIDsOptimizationEnabled() == false) {
updateAutoIdTimestamp(Long.MAX_VALUE, true);
}
final TranslogDeletionPolicy translogDeletionPolicy = new TranslogDeletionPolicy(
engineConfig.getIndexSettings().getTranslogRetentionSize().getBytes(),
engineConfig.getIndexSettings().getTranslogRetentionAge().getMillis()
Expand Down Expand Up @@ -2402,12 +2399,6 @@ public void onSettingsChanged() {
mergeScheduler.refreshConfig();
// config().isEnableGcDeletes() or config.getGcDeletesInMillis() may have changed:
maybePruneDeletes();
if (engineConfig.isAutoGeneratedIDsOptimizationEnabled() == false) {
// this is an anti-viral settings you can only opt out for the entire index
// only if a shard starts up again due to relocation or if the index is closed
// the setting will be re-interpreted if it's set to true
updateAutoIdTimestamp(Long.MAX_VALUE, true);
}
final TranslogDeletionPolicy translogDeletionPolicy = translog.getDeletionPolicy();
final IndexSettings indexSettings = engineConfig.getIndexSettings();
translogDeletionPolicy.setRetentionAgeInMillis(indexSettings.getTranslogRetentionAge().getMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import org.elasticsearch.index.analysis.AnalysisRegistry;
import org.elasticsearch.index.cache.request.ShardRequestCache;
import org.elasticsearch.index.engine.CommitStats;
import org.elasticsearch.index.engine.EngineConfig;
import org.elasticsearch.index.engine.EngineFactory;
import org.elasticsearch.index.engine.InternalEngineFactory;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
Expand Down Expand Up @@ -494,11 +493,6 @@ private synchronized IndexService createIndexService(final String reason,
List<IndexEventListener> builtInListeners,
IndexingOperationListener... indexingOperationListeners) throws IOException {
final IndexSettings idxSettings = new IndexSettings(indexMetaData, settings, indexScopedSettings);
if (idxSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)
&& EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.exists(idxSettings.getSettings())) {
throw new IllegalArgumentException(
"Setting [" + EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey() + "] was removed in version 7.0.0");
}
// we ignore private settings since they are not registered settings
indexScopedSettings.validate(indexMetaData.getSettings(), true, true, true);
logger.debug("creating Index [{}], shards [{}]/[{}] - reason [{}]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,48 +642,4 @@ public static ClusterState createClusterForShardLimitTest(int nodesInCluster, in
.build();
}

public void testOptimizeAutoGeneratedIdsSettingRemoval() throws Exception {
final IndicesService indicesService = getIndicesService();

final Index index = new Index("foo-index", UUIDs.randomBase64UUID());
Settings.Builder builder = Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_7_0_0)
.put(IndexMetaData.SETTING_INDEX_UUID, index.getUUID());
IndexMetaData indexMetaData = new IndexMetaData.Builder(index.getName())
.settings(builder.build())
.numberOfShards(1)
.numberOfReplicas(0)
.build();
IndexService indexService = indicesService.createIndex(indexMetaData, Collections.emptyList());
assertNotNull(indexService);

final Index index2 = new Index("bar-index", UUIDs.randomBase64UUID());
Settings.Builder builder2 = Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_7_0_0)
.put(IndexMetaData.SETTING_INDEX_UUID, index2.getUUID())
.put(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey(), randomBoolean());
IndexMetaData indexMetaData2 = new IndexMetaData.Builder(index2.getName())
.settings(builder2.build())
.numberOfShards(1)
.numberOfReplicas(0)
.build();
IllegalArgumentException ex = expectThrows(IllegalArgumentException.class,
() -> indicesService.createIndex(indexMetaData2, Collections.emptyList()));
assertEquals("Setting [" + EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey() + "] was removed in version 7.0.0",
ex.getMessage());

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);
builder = Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, version)
.put(IndexMetaData.SETTING_INDEX_UUID, index2.getUUID())
.put(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS.getKey(), randomBoolean());
IndexMetaData indexMetaData3 = new IndexMetaData.Builder(index2.getName())
.settings(builder.build())
.numberOfShards(1)
.numberOfReplicas(0)
.build();
IndexService indexService2 = indicesService.createIndex(indexMetaData3, Collections.emptyList());
assertNotNull(indexService2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.MapperTestUtils;
import org.elasticsearch.index.engine.EngineConfig;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.VersionUtils;
Expand Down Expand Up @@ -230,7 +229,6 @@ public void testDynamicIndexSettingsAreClassified() {
replicatedSettings.add(MapperService.INDEX_MAPPER_DYNAMIC_SETTING);
replicatedSettings.add(IndexSettings.MAX_NGRAM_DIFF_SETTING);
replicatedSettings.add(IndexSettings.MAX_SHINGLE_DIFF_SETTING);
replicatedSettings.add(EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS);

for (Setting<?> setting : IndexScopedSettings.BUILT_IN_INDEX_SETTINGS) {
if (setting.isDynamic()) {
Expand Down