kezhenxu94 commented on a change in pull request #7772:
URL: https://github.com/apache/skywalking/pull/7772#discussion_r714419315



##########
File path: 
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 @@ protected boolean isExists(Model model) {
         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())) {

Review comment:
       If this is the only condition, I think a basic test should cover it, 
this is a very basic logic and should be discovered at test phase, not runtime
   
   ```java
           assertThat(templateClient.exists(name)).isTrue();
   ```
   
   
https://github.com/apache/skywalking/blob/73b6c67344d83cabe3014fc33898eb15f3bc4063/oap-server/server-library/library-elasticsearch-client/src/test/java/org/apache/skywalking/library/elasticsearch/ITElasticSearchTest.java#L102-L107




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to