From 451c87f48668b5ca7562517fe38c80cbf93a1293 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 17 Aug 2011 02:58:55 +0300 Subject: [PATCH] Update Settings: Allow to dynamically set index.gc_deletes setting, closes #1251. --- .../elasticsearch/index/engine/robin/RobinEngine.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java index 756b5c4c202..fed64ff7439 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java @@ -102,7 +102,7 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine { private final AtomicBoolean optimizeMutex = new AtomicBoolean(); - private final long gcDeletesInMillis; + private long gcDeletesInMillis; private final ThreadPool threadPool; @@ -1231,13 +1231,20 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine { IndexMetaData.addDynamicSettings( "index.term_index_interval", "index.term_index_divisor", - "index.index_concurrency" + "index.index_concurrency", + "index.gc_deletes" ); } class ApplySettings implements IndexSettingsService.Listener { @Override public void onRefreshSettings(Settings settings) { + long gcDeletesInMillis = indexSettings.getAsTime("index.gc_deletes", TimeValue.timeValueMillis(RobinEngine.this.gcDeletesInMillis)).millis(); + if (gcDeletesInMillis != RobinEngine.this.gcDeletesInMillis) { + logger.info("updating index.gc_deletes from [{}] to [{}]", TimeValue.timeValueMillis(RobinEngine.this.gcDeletesInMillis), TimeValue.timeValueMillis(gcDeletesInMillis)); + RobinEngine.this.gcDeletesInMillis = gcDeletesInMillis; + } + int termIndexInterval = settings.getAsInt("index.term_index_interval", RobinEngine.this.termIndexInterval); int termIndexDivisor = settings.getAsInt("index.term_index_divisor", RobinEngine.this.termIndexDivisor); // IndexReader#DEFAULT_TERMS_INDEX_DIVISOR int indexConcurrency = settings.getAsInt("index.index_concurrency", RobinEngine.this.indexConcurrency);