maqingxiang commented on a change in pull request #8008: [FLINK-11963][History 
Server]Add time-based cleanup mechanism in history server
URL: https://github.com/apache/flink/pull/8008#discussion_r268163453
 
 

 ##########
 File path: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java
 ##########
 @@ -153,9 +157,20 @@ public void run() {
                                                continue;
                                        }
                                        boolean updateOverview = false;
+                                       long now = System.currentTimeMillis();
                                        for (FileStatus jobArchive : 
jobArchives) {
                                                Path jobArchivePath = 
jobArchive.getPath();
                                                String jobID = 
jobArchivePath.getName();
+                                               if (retainedApplicationsMillis 
> 0L && now - jobArchive.getModificationTime() > retainedApplicationsMillis) {
+                                                       if 
(LOG.isDebugEnabled()) {
+                                                               
LOG.debug("delete the old archived job for path {}." + 
jobArchivePath.toString());
+                                                       }
+                                                       
jobArchivePath.getFileSystem().delete(jobArchivePath, false);
+                                                       continue;
+                                               } else {
+                                                       LOG.warn("Negative or 
zero values {} of the historyserver.archive.fs.retained-application-millis " +
 
 Review comment:
   I am very sorry that my carelessness caused this mistake, Thanks a lot for 
reviewing it again!

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


With regards,
Apache Git Services

Reply via email to