diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-08 16:08:05 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-08 16:08:05 +0100 |
commit | 93ea25fb4634f91147b4c49b5df2c2ad48177e00 (patch) | |
tree | 566c9718f10a9d3fd46d6bf22c832b107e16cb2f /server/sonar-server | |
parent | 01957cc955464094f78975ace68e5e74cf7d78b8 (diff) | |
download | sonarqube-93ea25fb4634f91147b4c49b5df2c2ad48177e00.tar.gz sonarqube-93ea25fb4634f91147b4c49b5df2c2ad48177e00.zip |
Improve stability of sonar-server-benchmarks
Optimize Lucene FS so it does not evolve when estimating size
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java | 6 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java | 9 |
2 files changed, 10 insertions, 5 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 b08af55a94e..a1af20bc681 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 @@ -149,11 +149,7 @@ public class BulkIndexer implements Startable { // optimize lucene segments and revert index settings // Optimization must be done before re-applying replicas: // http://www.elasticsearch.org/blog/performance-considerations-elasticsearch-indexing/ - // TODO do not use nativeClient, else request is not profiled - client.nativeClient().admin().indices().prepareOptimize(indexName) - .setMaxNumSegments(1) - .setWaitForMerge(true) - .get(); + client.prepareOptimize(indexName).get(); updateSettings(largeInitialSettings); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java b/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java index 2e737b8c4be..eb658126ed8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java @@ -29,6 +29,7 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder; import org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder; +import org.elasticsearch.action.admin.indices.optimize.OptimizeRequestBuilder; import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder; import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder; import org.elasticsearch.action.bulk.BulkRequestBuilder; @@ -185,6 +186,14 @@ public class EsClient implements Startable { return new ProxyIndexRequestBuilder(client, profiling).setIndex(index).setType(type); } + public OptimizeRequestBuilder prepareOptimize(String indexName) { + // TODO add proxy for profiling + return nativeClient().admin().indices().prepareOptimize(indexName) + .setMaxNumSegments(1) + .setWaitForMerge(true); + } + + public long getLastUpdatedAt(String indexName, String typeName) { SearchRequestBuilder request = prepareSearch(indexName) .setTypes(typeName) |