gaborgsomogyi opened a new pull request #15762: URL: https://github.com/apache/flink/pull/15762
## What is the purpose of the change When history server started initially it throws the following exception: ``` 2021-04-23 23:25:17,487 ERROR org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveFetcher [] - Failed to update job overview. java.nio.file.NoSuchFileException: /var/folders/jd/35_sh46s7zq0qc6khfw8hc800000gn/T/flink-web-history-35a77053-0e52-4cb3-8d22-626e3ce3cbd7/jobs/overview.json at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) ~[?:1.8.0_282] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_282] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_282] at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214) ~[?:1.8.0_282] at java.nio.file.Files.newByteChannel(Files.java:361) ~[?:1.8.0_282] at java.nio.file.Files.createFile(Files.java:632) ~[?:1.8.0_282] at org.apache.flink.runtime.webmonitor.history.HistoryServer.createOrGetFile(HistoryServer.java:324) ~[flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveFetcher.updateJobOverview(HistoryServerArchiveFetcher.java:464) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveFetcher.access$000(HistoryServerArchiveFetcher.java:74) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveFetcher$JobArchiveFetcherTask.<init>(HistoryServerArchiveFetcher.java:199) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServerArchiveFetcher.<init>(HistoryServerArchiveFetcher.java:124) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServer.<init>(HistoryServer.java:230) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServer.<init>(HistoryServer.java:146) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServer$1.call(HistoryServer.java:130) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServer$1.call(HistoryServer.java:127) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] at org.apache.flink.runtime.webmonitor.history.HistoryServer.main(HistoryServer.java:126) [flink-dist_2.11-1.14-SNAPSHOT.jar:1.14-SNAPSHOT] ``` The issue is that `webDir` not yet created by `HistoryServer` when `HistoryServerArchiveFetcher` tries to reach `jobs/overview.json` file in it. The directory will be created later on so this PR is to eliminate the initial issue. ## Brief change log * `webDir` is now created in the constructor of `HistoryServer` * Double `webDir` creation in `HistoryServer.start` is eliminated * `HistoryServerArchiveFetcher` now throws `IOException` if `webJobDir` or `webOverviewDir` creation if failed. ## Verifying this change This change added tests and can be verified as follows: - Manually verified the change by running the following command locally and double checked there is no exception ``` bin/historyserver.sh start-foreground ``` ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable -- 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: us...@infra.apache.org