xuanyuan1hao opened a new issue #7154:
URL: https://github.com/apache/skywalking/issues/7154


   i change code on file HistoryDeleteEsDAO .java  in about 59 lines 
   
   long deadline2 = Long.parseLong(new 
DateTime().plusDays(-1).toString("yyyyMMdd"));
   for (String index : indexes) {
   long timeSeries = TimeSeriesUtils.isolateTimeFromIndexName(index);
   if (deadline >= timeSeries||(client.indexDocIsZero(tableName) && deadline2>= 
timeSeries)) {
   prepareDeleteIndexes.add(index);
   } else {
   leftIndices.add(index);
   }
   }
   
   add method on file  ElasticSearchClient.java 
   
   /**
        * adjust index is empty
        * @param tableName
        * @return
        * @throws IOException
        */
       public boolean indexDocIsZero(String tableName) throws IOException {
           SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
           SearchRequest rq = new SearchRequest();
           rq.indices(tableName);
           rq.source(sourceBuilder);
           sourceBuilder.from(0);
           sourceBuilder.size(1);
           SearchResponse search = client.search(rq);
           return search.getHits().getHits().length==0;
       }
   


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

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


Reply via email to