diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-09-16 15:03:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-09-16 15:27:52 +0200 |
commit | 88591239560c1b90f40c56ec322462a7eaaea173 (patch) | |
tree | de4002d0b1889f8afeee4ce5567b3a2f94abf15f /server | |
parent | 1d483b2371f8d63cf42ec7fd425c32ffc43687bb (diff) | |
download | sonarqube-88591239560c1b90f40c56ec322462a7eaaea173.tar.gz sonarqube-88591239560c1b90f40c56ec322462a7eaaea173.zip |
Remove unused BulkIndexer#setDisableRefresh()
Diffstat (limited to 'server')
3 files changed, 1 insertions, 30 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java index 003ef866c86..d93cf53d157 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java @@ -68,7 +68,6 @@ public class BulkIndexer implements Startable { private final String indexName; private boolean large = false; private long flushByteSize = FLUSH_BYTE_SIZE; - private boolean disableRefresh = false; private BulkRequestBuilder bulkRequest = null; private Map<String, Object> largeInitialSettings = null; private final AtomicLong counter = new AtomicLong(0L); @@ -101,15 +100,6 @@ public class BulkIndexer implements Startable { return this; } - /** - * By default refresh of index is executed in method {@link #stop()}. Set to true - * to disable refresh. - */ - public BulkIndexer setDisableRefresh(boolean b) { - this.disableRefresh = b; - return this; - } - @Override public void start() { Preconditions.checkState(bulkRequest == null, ALREADY_STARTED_MESSAGE); @@ -204,10 +194,7 @@ public class BulkIndexer implements Startable { throw new IllegalStateException("Elasticsearch bulk requests still being executed after 10 minutes", e); } progress.stop(); - - if (!disableRefresh) { - client.prepareRefresh(indexName).get(); - } + client.prepareRefresh(indexName).get(); if (large) { // optimize lucene segments and revert index settings // Optimization must be done before re-applying replicas: diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexer.java index 53fbae1bf02..b91af14dc74 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexer.java @@ -97,7 +97,6 @@ public class IssueIndexer extends BaseIndexer { public void deleteProject(String uuid) { BulkIndexer bulk = new BulkIndexer(esClient, INDEX); - bulk.setDisableRefresh(false); bulk.start(); SearchRequestBuilder search = esClient.prepareSearch(INDEX) .setTypes(TYPE_ISSUE, TYPE_AUTHORIZATION) diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java index ff89f4a01b9..b201fd4cb68 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java @@ -102,21 +102,6 @@ public class BulkIndexerTest { assertThat(count()).isEqualTo(removeFrom); } - @Test - public void disable_refresh() { - BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX) - .setDisableRefresh(true); - indexer.start(); - indexer.add(newIndexRequest(42)); - indexer.add(newIndexRequest(78)); - indexer.stop(); - - assertThat(count()).isEqualTo(0); - - esTester.client().prepareRefresh(FakeIndexDefinition.INDEX).get(); - assertThat(count()).isEqualTo(2); - } - private long count() { return esTester.countDocuments("fakes", "fake"); } |