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



##########
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:
       > The current conditions checking could fail in daily used, it is not a 
bug, and we have to suffer endless question and bug report on GitHub.
   
   I don't mean to keep the current conditions, I mean if the condition is to 
be `if ((templateExists && !template.isPresent()) || (!templateExists && 
template.isPresent()))`, then this is a very basic function that we should test 
in the perspective of ES client.
   
   > I was proposing this due to we can't test all server versions, and as we 
are not official, we can't tell when breaking change happens.
   
   The supported versions are fixed and the codes won't run on un-tested 
versions.
   
   
https://github.com/apache/skywalking/blob/73b6c67344d83cabe3014fc33898eb15f3bc4063/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java#L67
   
   We will manually test a new ES version, and add it into our supported list, 
otherwise if users run on a future ES server for example 8.2, the OAP won't 
even start




-- 
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