-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-52914][CORE] Support On-Demand Log Loading for rolling logs in History Server
#51604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
600eb8a
ef9b833
db5773b
834ba16
4ee04af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -321,13 +321,13 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) | |||||||||
| override def getLastUpdatedTime(): Long = lastScanTime.get() | ||||||||||
|
|
||||||||||
| override def getAppUI(appId: String, attemptId: Option[String]): Option[LoadedAppUI] = { | ||||||||||
| val logPath = RollingEventLogFilesWriter.EVENT_LOG_DIR_NAME_PREFIX + | ||||||||||
| Utils.nameForAppAndAttempt(appId, attemptId) | ||||||||||
|
||||||||||
| val logPath = RollingEventLogFilesWriter.EVENT_LOG_DIR_NAME_PREFIX + | |
| Utils.nameForAppAndAttempt(appId, attemptId) | |
| val logPath = RollingEventLogFilesWriter.EVENT_LOG_DIR_NAME_PREFIX + | |
| EventLogFileWriter.nameForAppAndAttempt(appId, attemptId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Ya, I agree. For now, it's a simple alias, you are right for the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we are trying to push for usage of RollingEventLogFilesWriter as the new default but for users who have single event logs and if they try to get the UI for an app, will this functionality not break for them since EVENT_LOG_ROLLING_ON_DEMAND_LOAD_ENABLED is true by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on what we can break here, @thejdeep ?
will this functionality not break for them since EVENT_LOG_ROLLING_ON_DEMAND_LOAD_ENABLED is true by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dummy metadata is added and cleaned up at FileNotFound exception immediate in this function as @mridulm requested. It works for both non-existing appId and SingleFile logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if EVENT_LOG_ENABLE_ROLLING is disabled? Should we only do this if EVENT_LOG_ENABLE_ROLLING is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, EVENT_LOG_ENABLE_ROLLING is per-application setting. This is SHS, @viirya .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I proposed the config name spark.history.fs.update.onDemandEnabled at the first commit because this is SHS setting. However, it was revised during the review in order to be clear in the context of rolling.
- spark.history.fs.update.onDemandEnabled
+ spark.history.fs.eventLog.rolling.onDemandLoadEnabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I see. A bit confusing setup to me. EVENT_LOG_ENABLE_ROLLING determines at the EventLoggingListener in SparkContext application. When FsHistoryProvider creates EventLogFileReader, it doesn't care about this config but decide it is single log or rolling log based on attempt lastIndex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it sounds confusing. Basically, it's the same for event log compression codec.
Since a Spark job can choose spark.eventLog.compress and spark.eventLog.compression.codec arbitrarily, we need to inference from the file name. It's inevitable because Writers(Spark job) and Reader(SHS) are independent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't quite understand what this did. Seems loadFromFallbackLocation loads a dummy record from the log path into listing?
But what does this FileNotFoundException catch? Why it deletes the dummy record immediately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review, @viirya .
Yes, this adds a dummy record (based on the user request) to proceed to load the actual file. However, if the actual file doesn't exist, FoundNotFoundException will be thrown. It means it's a user mistake. In that case, since we don't need this dummy record, we cleaned up.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1645,7 +1645,7 @@ abstract class FsHistoryProviderSuite extends SparkFunSuite with Matchers with P | |
| withTempDir { dir => | ||
| val conf = createTestConf(true) | ||
| conf.set(HISTORY_LOG_DIR, dir.getAbsolutePath) | ||
| conf.set(ON_DEMAND_ENABLED, onDemandEnabled) | ||
| conf.set(EVENT_LOG_ROLLING_ON_DEMAND_LOAD_ENABLED, onDemandEnabled) | ||
| val hadoopConf = SparkHadoopUtil.newConfiguration(conf) | ||
| val provider = new FsHistoryProvider(conf) | ||
|
|
||
|
|
@@ -1656,9 +1656,14 @@ abstract class FsHistoryProviderSuite extends SparkFunSuite with Matchers with P | |
| SparkListenerJobStart(1, 0, Seq.empty)), rollFile = false) | ||
| writer1.stop() | ||
|
|
||
| assert(provider.getListing().length === 0) | ||
| assert(dir.listFiles().length === 1) | ||
| assert(provider.getListing().length === 0) | ||
| assert(provider.getAppUI("app1", None).isDefined == onDemandEnabled) | ||
| assert(provider.getListing().length === (if (onDemandEnabled) 1 else 0)) | ||
|
|
||
| assert(dir.listFiles().length === 1) | ||
| assert(provider.getAppUI("nonexist", None).isEmpty) | ||
| assert(provider.getListing().length === (if (onDemandEnabled) 1 else 0)) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new line verifies the cleanup, @mridulm . |
||
|
|
||
| provider.stop() | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RollingEventLogFilesWriter.getAppEventLogDirPathalso considerslogBaseDir, don't we need to consider it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we don't need
logBaseDirat this info.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see.
AttemptInfoWrapper.logPathdoesn't contain base dir. WhenFsHistoryProvidertried to read for attempt, it will append base dir.