kezhenxu94 commented on code in PR #11119:
URL: https://github.com/apache/skywalking/pull/11119#discussion_r1269029979


##########
oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/HistoryDeleteEsDAO.java:
##########
@@ -63,20 +62,26 @@ public void deleteHistory(Model model, String 
timeBucketColumnName, int ttl) {
             }
             return;
         }
+
+        String latestIndex = TimeSeriesUtils.latestWriteIndexName(model);
+        if (!client.isExistsIndex(latestIndex)) {
+            client.createIndex(latestIndex);
+            if (log.isDebugEnabled()) {
+                log.debug("Latest index = {} is not exist, create.", 
latestIndex);
+            }
+        }

Review Comment:
   Please revert the `try-catch` back, the index might be created by ES when 
the data is received and if you remove this `try-catch` exception might be 
thrown.
   
   Even if you check `if (!client.isExistsIndex(latestIndex)) {` but data might 
be sent to ES after the `if` statement before the 
`client.createIndex(latestIndex);`



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