diff options
author | ssjenka <ssjenka@ops-slave-fedora25-1.internal.sonarsource.com> | 2017-05-19 18:07:13 +0200 |
---|---|---|
committer | ssjenka <ssjenka@ops-slave-fedora25-1.internal.sonarsource.com> | 2017-05-19 18:07:13 +0200 |
commit | addbcd397f3df7ae6cfd5f1c71a96381d30ed22f (patch) | |
tree | b4935554918e2b0156eaa5348ce6e70068a858cb | |
parent | 475d7778205c434408960be041b52013acfc7ee0 (diff) | |
parent | ea9258c5f831b549a152b608e3cb1afc6afa7af3 (diff) | |
download | sonarqube-addbcd397f3df7ae6cfd5f1c71a96381d30ed22f.tar.gz sonarqube-addbcd397f3df7ae6cfd5f1c71a96381d30ed22f.zip |
Automatic merge from branch-6.4
* origin/branch-6.4:
SONAR-9286 Fix ES error at startup
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/es/IndexerStartupTask.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/IndexerStartupTask.java b/server/sonar-server/src/main/java/org/sonar/server/es/IndexerStartupTask.java index fa0e069319f..07ae9a9914b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/IndexerStartupTask.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/IndexerStartupTask.java @@ -88,6 +88,7 @@ public class IndexerStartupTask { private void setInitialized(IndexType indexType) { String index = indexType.getIndex(); + waitForIndexGreen(index); closeIndex(index); setIndexSetting(index, getInitializedSettingName(indexType), true); openIndex(index); @@ -115,6 +116,11 @@ public class IndexerStartupTask { ClusterHealthAction.INSTANCE.newRequestBuilder(nativeClient).setIndices(index).setWaitForYellowStatus().get(TimeValue.timeValueMinutes(10)); } + private void waitForIndexGreen(String index) { + Client nativeClient = esClient.nativeClient(); + ClusterHealthAction.INSTANCE.newRequestBuilder(nativeClient).setIndices(index).setWaitForGreenStatus().get(TimeValue.timeValueMinutes(10)); + } + private static String getInitializedSettingName(IndexType indexType) { return "index." + SETTING_PREFIX_INITIAL_INDEXING_FINISHED + indexType.getType(); } |