tillrohrmann commented on a change in pull request #12636:
URL: https://github.com/apache/flink/pull/12636#discussion_r440102059



##########
File path: 
flink-core/src/main/java/org/apache/flink/configuration/HistoryServerOptions.java
##########
@@ -99,6 +99,11 @@
                        .withDescription("Enable HTTPs access to the 
HistoryServer web frontend. This is applicable only when the" +
                                " global SSL flag security.ssl.enabled is set 
to true.");
 
+       public static final ConfigOption<Integer> HISTORY_SERVER_MAX_SIZE =
+               key("historyserver.max.history.size")

Review comment:
       Maybe
   ```suggestion
                key("historyserver.retainedJobs")
   ```

##########
File path: 
flink-core/src/main/java/org/apache/flink/configuration/HistoryServerOptions.java
##########
@@ -99,6 +99,11 @@
                        .withDescription("Enable HTTPs access to the 
HistoryServer web frontend. This is applicable only when the" +
                                " global SSL flag security.ssl.enabled is set 
to true.");
 
+       public static final ConfigOption<Integer> HISTORY_SERVER_MAX_SIZE =
+               key("historyserver.max.history.size")

Review comment:
       Or `historyserver.history.max-size`

##########
File path: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java
##########
@@ -215,6 +226,12 @@ public void run() {
                                                                refreshDir, 
jobID, iae);
                                                        continue;
                                                }
+
+                                               if (++historySize > 
maxHistorySize) {

Review comment:
       I would suggest to increment `historySize` in a separate line. This is 
usually more robust because people might confuse `++historySize` and 
`historySize++` when refactoring the if condition in the future.

##########
File path: 
flink-core/src/main/java/org/apache/flink/configuration/HistoryServerOptions.java
##########
@@ -99,6 +99,11 @@
                        .withDescription("Enable HTTPs access to the 
HistoryServer web frontend. This is applicable only when the" +
                                " global SSL flag security.ssl.enabled is set 
to true.");
 
+       public static final ConfigOption<Integer> HISTORY_SERVER_MAX_SIZE =
+               key("historyserver.max.history.size")
+                       .defaultValue(50)
+                       .withDescription("Maximum number of jobs to keep in the 
history server.");

Review comment:
       We should also add a configuration value which stores unlimited number 
of jobs (e.g. `-1`) and document it.

##########
File path: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java
##########
@@ -295,6 +315,19 @@ public void run() {
                        }
                }
 
+               private List<ArchiveEvent> cleanupJobsBeyondSizeLimit(Set<Path> 
jobArchivesToRemove) {
+                       Set<String> jobIdsToRemoveFromOverview = new 
HashSet<>();
+                       for (Path archive : jobArchivesToRemove) {
+                               
jobIdsToRemoveFromOverview.add(archive.getName());
+                               try {
+                                       archive.getFileSystem().delete(archive, 
false);
+                               } catch (IOException ioe) {
+                                       LOG.error("Error while deleting old 
archive " + archive, ioe);

Review comment:
       I would reduce the log level to `warn` because the history server will 
still work if this should happen.




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