Merge pull request #15964 from s1monw/flush_on_close_final
Remove updatability of `index.flush_on_close`
This commit is contained in:
commit
8c10616df8
|
@ -149,7 +149,6 @@ public class ClusterModule extends AbstractModule {
|
||||||
registerIndexDynamicSetting(IndexSettings.INDEX_REFRESH_INTERVAL, Validator.TIME);
|
registerIndexDynamicSetting(IndexSettings.INDEX_REFRESH_INTERVAL, Validator.TIME);
|
||||||
registerIndexDynamicSetting(PrimaryShardAllocator.INDEX_RECOVERY_INITIAL_SHARDS, Validator.EMPTY);
|
registerIndexDynamicSetting(PrimaryShardAllocator.INDEX_RECOVERY_INITIAL_SHARDS, Validator.EMPTY);
|
||||||
registerIndexDynamicSetting(IndexSettings.INDEX_GC_DELETES_SETTING, Validator.TIME);
|
registerIndexDynamicSetting(IndexSettings.INDEX_GC_DELETES_SETTING, Validator.TIME);
|
||||||
registerIndexDynamicSetting(IndexSettings.INDEX_FLUSH_ON_CLOSE, Validator.BOOLEAN);
|
|
||||||
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, Validator.TIME);
|
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, Validator.TIME);
|
||||||
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, Validator.TIME);
|
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, Validator.TIME);
|
||||||
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, Validator.TIME);
|
registerIndexDynamicSetting(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, Validator.TIME);
|
||||||
|
|
|
@ -64,10 +64,10 @@ public final class IndexSettings {
|
||||||
public static final TimeValue DEFAULT_GC_DELETES = TimeValue.timeValueSeconds(60);
|
public static final TimeValue DEFAULT_GC_DELETES = TimeValue.timeValueSeconds(60);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index setting to control if a flush is executed before engine is closed
|
* Index setting to control if a flush is executed before engine is closed. The default is <code>true</code>
|
||||||
* This setting is realtime updateable.
|
|
||||||
*/
|
*/
|
||||||
public static final String INDEX_FLUSH_ON_CLOSE = "index.flush_on_close";
|
public static final String INDEX_FLUSH_ON_CLOSE = "index.flush_on_close";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index setting to enable / disable deletes garbage collection.
|
* Index setting to enable / disable deletes garbage collection.
|
||||||
* This setting is realtime updateable
|
* This setting is realtime updateable
|
||||||
|
@ -97,7 +97,7 @@ public final class IndexSettings {
|
||||||
private final TimeValue syncInterval;
|
private final TimeValue syncInterval;
|
||||||
private volatile TimeValue refreshInterval;
|
private volatile TimeValue refreshInterval;
|
||||||
private volatile ByteSizeValue flushThresholdSize;
|
private volatile ByteSizeValue flushThresholdSize;
|
||||||
private volatile boolean flushOnClose = true;
|
private final boolean flushOnClose;
|
||||||
private final MergeSchedulerConfig mergeSchedulerConfig;
|
private final MergeSchedulerConfig mergeSchedulerConfig;
|
||||||
private final MergePolicyConfig mergePolicyConfig;
|
private final MergePolicyConfig mergePolicyConfig;
|
||||||
|
|
||||||
|
@ -391,12 +391,6 @@ public final class IndexSettings {
|
||||||
this.flushThresholdSize = flushThresholdSize;
|
this.flushThresholdSize = flushThresholdSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean flushOnClose = settings.getAsBoolean(INDEX_FLUSH_ON_CLOSE, this.flushOnClose);
|
|
||||||
if (flushOnClose != this.flushOnClose) {
|
|
||||||
logger.info("updating {} from [{}] to [{}]", INDEX_FLUSH_ON_CLOSE, this.flushOnClose, flushOnClose);
|
|
||||||
this.flushOnClose = flushOnClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
final int maxThreadCount = settings.getAsInt(MergeSchedulerConfig.MAX_THREAD_COUNT, mergeSchedulerConfig.getMaxThreadCount());
|
final int maxThreadCount = settings.getAsInt(MergeSchedulerConfig.MAX_THREAD_COUNT, mergeSchedulerConfig.getMaxThreadCount());
|
||||||
if (maxThreadCount != mergeSchedulerConfig.getMaxThreadCount()) {
|
if (maxThreadCount != mergeSchedulerConfig.getMaxThreadCount()) {
|
||||||
logger.info("updating [{}] from [{}] to [{}]", MergeSchedulerConfig.MAX_THREAD_COUNT, mergeSchedulerConfig.getMaxMergeCount(), maxThreadCount);
|
logger.info("updating [{}] from [{}] to [{}]", MergeSchedulerConfig.MAX_THREAD_COUNT, mergeSchedulerConfig.getMaxMergeCount(), maxThreadCount);
|
||||||
|
|
|
@ -129,25 +129,13 @@ import static org.hamcrest.Matchers.equalTo;
|
||||||
public class IndexShardTests extends ESSingleNodeTestCase {
|
public class IndexShardTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
public void testFlushOnDeleteSetting() throws Exception {
|
public void testFlushOnDeleteSetting() throws Exception {
|
||||||
boolean initValue = randomBoolean();
|
final boolean booleanValue = randomBoolean();
|
||||||
createIndex("test", settingsBuilder().put(IndexSettings.INDEX_FLUSH_ON_CLOSE, initValue).build());
|
createIndex("test", settingsBuilder().put(IndexSettings.INDEX_FLUSH_ON_CLOSE, booleanValue).build());
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
|
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
|
||||||
IndexService test = indicesService.indexService("test");
|
IndexService test = indicesService.indexService("test");
|
||||||
IndexShard shard = test.getShardOrNull(0);
|
IndexShard shard = test.getShardOrNull(0);
|
||||||
assertEquals(initValue, shard.getIndexSettings().isFlushOnClose());
|
assertEquals(booleanValue, shard.getIndexSettings().isFlushOnClose());
|
||||||
final boolean newValue = !initValue;
|
|
||||||
assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexSettings.INDEX_FLUSH_ON_CLOSE, newValue).build()));
|
|
||||||
assertEquals(newValue, shard.getIndexSettings().isFlushOnClose());
|
|
||||||
|
|
||||||
try {
|
|
||||||
assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexSettings.INDEX_FLUSH_ON_CLOSE, "FOOBAR").build()));
|
|
||||||
fail("exception expected");
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
assertEquals(newValue, shard.getIndexSettings().isFlushOnClose());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWriteShardState() throws Exception {
|
public void testWriteShardState() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue