From: Simon Brandhof Date: Sat, 29 Nov 2014 11:41:39 +0000 (+0100) Subject: End of CI error investigations - creation of ES indices was not synchronous, so faile... X-Git-Tag: 5.0-RC1~149 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7aa79a9d7cd5cfb25c479a53349adf1e86a7ee22;p=sonarqube.git End of CI error investigations - creation of ES indices was not synchronous, so failed on slow boxes --- diff --git a/server/sonar-server/pom.xml b/server/sonar-server/pom.xml index e56b41df183..f928fe08718 100644 --- a/server/sonar-server/pom.xml +++ b/server/sonar-server/pom.xml @@ -9,11 +9,10 @@ .. sonar-server - jar SonarQube :: Server - -Xmx1G -Djava.awt.headless=true -XX:MaxPermSize=128m + -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=128m 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 ff73df80f91..2e737b8c4be 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 @@ -41,6 +41,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchScrollRequestBuilder; import org.elasticsearch.client.Client; +import org.elasticsearch.common.Priority; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.metrics.max.Max; @@ -100,7 +101,6 @@ public class EsClient implements Startable { return health; } - public RefreshRequestBuilder prepareRefresh(String... indices) { return new ProxyRefreshRequestBuilder(client, profiling).setIndices(indices); } @@ -129,6 +129,10 @@ public class EsClient implements Startable { return new ProxyClusterHealthRequestBuilder(client, profiling).setIndices(indices); } + public void waitForStatus(ClusterHealthStatus status) { + prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForStatus(status).get(); + } + public IndicesExistsRequestBuilder prepareExists(String... indices) { return new ProxyIndicesExistsRequestBuilder(client, profiling, indices); } @@ -200,7 +204,7 @@ public class EsClient implements Startable { @Override public void stop() { // TODO re-enable when SearchClient is dropped - //client.close(); + // client.close(); } protected Client nativeClient() { diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java b/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java index 6f9a01c63f3..2d3a8f7c255 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java @@ -20,9 +20,9 @@ package org.sonar.server.es; import org.apache.commons.lang.StringUtils; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; -import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.ImmutableSettings; import org.picocontainer.Startable; import org.slf4j.Logger; @@ -85,7 +85,7 @@ public class IndexCreator implements ServerComponent, Startable { if (!indexResponse.isAcknowledged()) { throw new IllegalStateException("Failed to create index " + index.getName()); } - client.prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); + client.waitForStatus(ClusterHealthStatus.YELLOW); // create types for (Map.Entry entry : index.getTypes().entrySet()) { @@ -99,6 +99,7 @@ public class IndexCreator implements ServerComponent, Startable { throw new IllegalStateException("Failed to create type " + entry.getKey()); } } + client.waitForStatus(ClusterHealthStatus.YELLOW); } private void deleteIndex(String indexName) { 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 1699c62b231..0d855cdfe70 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 @@ -25,13 +25,11 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class BulkIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java index aafd7c14985..66b91c01ede 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java @@ -19,7 +19,6 @@ */ package org.sonar.server.es; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.sonar.server.search.request.ProxyBulkRequestBuilder; @@ -43,7 +42,6 @@ import org.sonar.server.search.request.ProxySearchScrollRequestBuilder; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class EsClientTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java b/server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java index 087fc619ee9..ad08d619827 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java @@ -41,7 +41,6 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.search.SearchHit; -import org.junit.Ignore; import org.junit.rules.ExternalResource; import org.sonar.api.config.Settings; import org.sonar.api.platform.ComponentContainer; @@ -55,7 +54,6 @@ import java.util.List; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class EsTester extends ExternalResource { private static final int INSTANCE_ID = RandomUtils.nextInt(); @@ -69,7 +67,7 @@ public class EsTester extends ExternalResource { } protected void before() throws Throwable { - String nodeName = "es-ram-" + INSTANCE_ID; + String nodeName = "tmp-es-" + INSTANCE_ID; node = NodeBuilder.nodeBuilder().local(true).data(true).settings(ImmutableSettings.builder() .put("cluster.name", nodeName) .put("node.name", nodeName) diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java index 933db291824..8f46e89cc6b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java @@ -22,7 +22,6 @@ package org.sonar.server.es; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -33,7 +32,6 @@ import java.util.Map; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class IndexCreatorTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java index 38099b022b7..a0ea5860886 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java @@ -20,7 +20,6 @@ package org.sonar.server.issue.index; import org.elasticsearch.search.SearchHit; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.sonar.api.config.Settings; @@ -34,7 +33,6 @@ import java.util.List; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class IssueAuthorizationIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java index 5a283363fce..70544f861e2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java @@ -20,7 +20,6 @@ package org.sonar.server.issue.index; import com.google.common.collect.Iterators; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.sonar.api.config.Settings; @@ -33,7 +32,6 @@ import java.util.List; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class IssueIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java index eabe084163f..ced283fc0bb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java @@ -20,7 +20,6 @@ package org.sonar.server.source.index; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.sonar.api.config.Settings; @@ -28,7 +27,6 @@ import org.sonar.server.es.EsTester; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class SourceLineIndexTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java index 35c5e804525..b4c16ec448c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.index.query.QueryBuilders; import org.fest.assertions.MapAssert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.sonar.api.config.Settings; @@ -43,7 +42,6 @@ import java.util.Map; import static org.fest.assertions.Assertions.assertThat; -@Ignore public class SourceLineIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java index c8552358fd1..d2c4cab058f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java +++ b/server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java @@ -120,7 +120,6 @@ public class ServerTester extends ExternalResource { platform.addComponents(components); platform.doStart(); } catch (Exception e) { - LOG.error("Fail to start ServerTester", e); stop(); Throwables.propagate(e); }