[SPARK-56966][SPARK-56967][CORE] Auto-create missing event log directories#56035
Open
sharma-0311 wants to merge 1 commit into
Open
[SPARK-56966][SPARK-56967][CORE] Auto-create missing event log directories#56035sharma-0311 wants to merge 1 commit into
sharma-0311 wants to merge 1 commit into
Conversation
…rver log directories if they do not exist - FsHistoryProvider: when spark.history.fs.logDirectory does not exist, attempt to create it automatically via FileSystem.mkdirs instead of immediately failing. Falls back to a warning if creation fails. - EventLogFileWriters: in requireLogBaseDirAsDirectory(), check for directory existence before getFileStatus and auto-create via FileSystem.mkdirs if missing. This prevents FileNotFoundException when spark.eventLog.dir (including S3 paths) has not been pre-created.
dongjoon-hyun
requested changes
May 21, 2026
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you for making a PR. However, there is a reason why we didn't do this.
The Apache Spark community considers this is as one of the security feature. Apache Spark History server should work on the read-only storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR fixes two related issues where Spark fails when configured log directories do not already exist.
Changes
spark.history.fs.logDirectoryif missing before History Server startup.spark.eventLog.dirif missing before event logging initialization.Why are the changes needed?
Currently:
FsHistoryProviderfails when the configured history log directory does not exist.EventLogFileWriterthrowsFileNotFoundExceptionif the event log directory does not exist.This behavior affects local filesystems as well as S3/Hadoop-backed filesystems.
The fix creates the directories automatically using Hadoop
FileSystem.mkdirs()before validation proceeds.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added unit tests:
EventLogFileWritersSuiteFsHistoryProviderSuiteTested automatic creation of missing directories during initialization.