aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-03-20 00:06:13 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-03-20 00:06:13 +0100
commitc0f002c521c84fc7922e77c724347b0c92bfd020 (patch)
tree23a8be739dd65c171c6d0922d3ada5552fc702fb /server
parentc982bc9cc53606381c3898bea731907492ed0409 (diff)
downloadsonarqube-c0f002c521c84fc7922e77c724347b0c92bfd020.tar.gz
sonarqube-c0f002c521c84fc7922e77c724347b0c92bfd020.zip
Issue/sourceline indexing is faster - adjust timeouts
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java4
-rw-r--r--server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java11
2 files changed, 9 insertions, 6 deletions
diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
index 8abfd3d18d7..ded7df36c5c 100644
--- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
+++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
@@ -112,10 +112,10 @@ public class IssueIndexBenchmarkTest {
long period = System.currentTimeMillis() - start;
long throughputPerSecond = 1000 * issues.count.get() / period;
LOGGER.info(String.format("%d issues indexed in %d ms (%d docs/second)", issues.count.get(), period, throughputPerSecond));
- benchmark.expectAround("Throughput to index issues", throughputPerSecond, 3400, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
+ benchmark.expectAround("Throughput to index issues", throughputPerSecond, 5116, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
// be sure that physical files do not evolve during estimation of size
- tester.get(EsClient.class).prepareOptimize("issues").get();
+ tester.get(EsClient.class).prepareOptimize("issues").setWaitForMerge(true).get();
long dirSize = FileUtils.sizeOfDirectory(tester.getEsServerHolder().getHomeDir());
LOGGER.info(String.format("ES dir: " + FileUtils.byteCountToDisplaySize(dirSize)));
benchmark.expectBetween("ES dir size (b)", dirSize, 200L * FileUtils.ONE_MB, 420L * FileUtils.ONE_MB);
diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java
index 1c552af441c..ba6c4c0f236 100644
--- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java
+++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java
@@ -81,10 +81,10 @@ public class SourceIndexBenchmarkTest {
long nbLines = files.count.get() * LINES_PER_FILE;
long throughputPerSecond = 1000L * nbLines / period;
LOGGER.info(String.format("%d lines indexed in %d ms (%d docs/second)", nbLines, period, throughputPerSecond));
- benchmark.expectAround("Throughput to index source lines", throughputPerSecond, 7800, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
+ benchmark.expectAround("Throughput to index source lines", throughputPerSecond, 8950, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
// be sure that physical files do not evolve during estimation of size
- tester.get(EsClient.class).prepareOptimize(SourceLineIndexDefinition.INDEX).get();
+ tester.get(EsClient.class).prepareOptimize(SourceLineIndexDefinition.INDEX).setWaitForMerge(true).get();
long dirSize = FileUtils.sizeOfDirectory(tester.getEsServerHolder().getHomeDir());
LOGGER.info(String.format("ES dir: " + FileUtils.byteCountToDisplaySize(dirSize)));
benchmark.expectBetween("ES dir size (b)", dirSize, 103L * FileUtils.ONE_MB, 109L * FileUtils.ONE_MB);
@@ -108,6 +108,7 @@ public class SourceIndexBenchmarkTest {
private int currentProject = 0;
private AtomicLong count = new AtomicLong(0L);
private final FileSourceDb.Data.Builder dataBuilder = FileSourceDb.Data.newBuilder();
+ private final FileSourceDb.Line.Builder lineBuilder = FileSourceDb.Line.newBuilder();
SourceIterator(long nbFiles, int nbLinesPerFile) {
this.nbFiles = nbFiles;
@@ -128,8 +129,10 @@ public class SourceIndexBenchmarkTest {
String projectUuid = "P" + currentProject;
String fileUuid = "FILE" + count.get();
dataBuilder.clear();
+
for (int indexLine = 1; indexLine <= nbLinesPerFile; indexLine++) {
- dataBuilder.addLinesBuilder()
+ lineBuilder.clear();
+ dataBuilder.addLines(lineBuilder
.setLine(indexLine)
.setScmRevision("REVISION_" + indexLine)
.setScmAuthor("a_guy")
@@ -146,7 +149,7 @@ public class SourceIndexBenchmarkTest {
.setScmDate(1_500_000_000_000L)
.setHighlighting("2,9,k;9,18,k")
.addAllDuplication(Arrays.asList(19, 33, 141))
- .build();
+ .build());
}
count.incrementAndGet();
if (count.get() % 500 == 0) {