You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/09/23 01:09:23 UTC

[skywalking] branch condition-precise created (now 0b7b89b)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a change to branch condition-precise
in repository https://gitbox.apache.org/repos/asf/skywalking.git.


      at 0b7b89b  Only report `bug warning` in precise conditions.

This branch includes the following new commits:

     new 0b7b89b  Only report `bug warning` in precise conditions.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[skywalking] 01/01: Only report `bug warning` in precise conditions.

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch condition-precise
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 0b7b89b9c5c463472460be0d971f1cbb4b0c4023
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Sep 23 09:09:04 2021 +0800

    Only report `bug warning` in precise conditions.
---
 .../storage/plugin/elasticsearch/base/StorageEsInstaller.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
index b678a98..1b464fc 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
@@ -70,14 +70,17 @@ public class StorageEsInstaller extends ModelInstaller {
         if (!model.isTimeSeries()) {
             return esClient.isExistsIndex(tableName);
         }
-        boolean exist = esClient.isExistsTemplate(tableName)
-            && esClient.isExistsIndex(TimeSeriesUtils.latestWriteIndexName(model));
+        boolean templateExists = esClient.isExistsTemplate(tableName);
         final Optional<IndexTemplate> template = esClient.getTemplate(tableName);
+        boolean lastIndexExists = esClient.isExistsIndex(TimeSeriesUtils.latestWriteIndexName(model));
 
-        if ((exist && !template.isPresent()) || (!exist && template.isPresent())) {
-            throw new Error("[Bug warning]ElasticSearch client query template result is not consistent. Please file an issue to Apache SkyWalking.(https://github.com/apache/skywalking/issues)");
+        if ((templateExists && !template.isPresent()) || (!templateExists && template.isPresent())) {
+            throw new Error("[Bug warning] ElasticSearch client query template result is not consistent. " +
+                                "Please file an issue to Apache SkyWalking.(https://github.com/apache/skywalking/issues)");
         }
 
+        boolean exist = templateExists && lastIndexExists;
+
         if (exist && IndexController.INSTANCE.isMetricModel(model)) {
             structures.putStructure(
                 tableName, template.get().getMappings()