dangshazi commented on code in PR #21185:
URL: https://github.com/apache/flink/pull/21185#discussion_r1099945870


##########
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java:
##########
@@ -340,15 +364,24 @@ void stop() {
                     LOG.warn("Error while shutting down 
WebFrontendBootstrap.", t);
                 }
 
-                ExecutorUtils.gracefulShutdown(1, TimeUnit.SECONDS, executor);
-
+                ExecutorUtils.gracefulShutdown(1, TimeUnit.MINUTES, 
fetcherExecutor, unzipExecutor);
                 try {
-                    LOG.info("Removing web dashboard root cache directory {}", 
webDir);
-                    FileUtils.deleteDirectory(webDir);
+                    LOG.info("Removing web dashboard cached WebFrontend files 
in dir {}", webDir);
+                    for (java.nio.file.Path path : 
FileUtils.listDirectory(webDir.toPath())) {
+                        if ((Files.isDirectory(path)
+                                        && 
path.toFile().getName().equals(ARCHIVED_JOBS_DIR))
+                                || (Files.isDirectory(path)
+                                        && 
path.toFile().getName().equals(JOBS_DIR))
+                                || (Files.isDirectory(path)
+                                        && 
path.toFile().getName().equals(OVERVIEWS_DIR))) {
+                            continue;
+                        }

Review Comment:
   > Why do we want to skip cleaning the cache files on termination?
   
   In our case,  `HistoryServer`  is deployed on a fixed machine
   
   It takes extra time to download all job archives when starting 
`HistoryServer`  on the same node. 
    
   So I think It's better for `HistoryServer` to skip cleaning the cache files 
on termination.
   
   `HistoryServer` will reload  job archives and Unzipped Job files left by 
last HistoryServer when HistoryServer starting in 
`org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveProcessor#initJobCache`
 
   



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