sarutak commented on code in PR #54575:
URL: https://github.com/apache/spark/pull/54575#discussion_r2884292162
##########
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala:
##########
@@ -122,6 +127,43 @@ private[history] class FsHistoryProvider(conf: SparkConf,
clock: Clock)
// Visible for testing
private[history] val fs: FileSystem = new
Path(logDir).getFileSystem(hadoopConf)
+ // Map from logDir to its FileSystem, for multi-path support.
+ // Visible for testing
+ private[history] val logDirFs: Map[String, FileSystem] = logDirs.map { dir =>
+ dir -> new Path(dir).getFileSystem(hadoopConf)
+ }.toMap
+
+ // Map from logDir to display name for UI
+ private val logDirToDisplayName: Map[String, String] = {
+ val names = conf.get(HISTORY_LOG_DIR_NAMES).map(_.split(",",
-1).map(_.trim))
+ names match {
+ case Some(n) if n.length == logDirs.length =>
+ val mapping = logDirs.zip(n).map { case (dir, name) =>
+ dir -> (if (name.nonEmpty) name else dir)
+ }
+ val displayNames = mapping.map(_._2)
+ val duplicates = displayNames.groupBy(identity).filter(_._2.size >
1).keys
+ require(duplicates.isEmpty,
+ s"Duplicate display names found in ${HISTORY_LOG_DIR_NAMES.key}: " +
Review Comment:
Yes.
https://github.com/apache/spark/pull/54575/changes/24ffc63f9b96ce3334978d0162acaacdc96d9f3b#diff-3671f7b6fdc23cb02c7cb4a674fbd6da9b02068554642c871e91a25f6354ee78R2099
##########
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala:
##########
@@ -122,6 +127,43 @@ private[history] class FsHistoryProvider(conf: SparkConf,
clock: Clock)
// Visible for testing
private[history] val fs: FileSystem = new
Path(logDir).getFileSystem(hadoopConf)
+ // Map from logDir to its FileSystem, for multi-path support.
+ // Visible for testing
Review Comment:
I think it's difficult because a test in `FsHistoryProviderSuite` uses `spy`
and `when(mockedProvider.logDirFs).thenReturn(...)`
[here](https://github.com/apache/spark/pull/54575/changes/24ffc63f9b96ce3334978d0162acaacdc96d9f3b#diff-3671f7b6fdc23cb02c7cb4a674fbd6da9b02068554642c871e91a25f6354ee78R1208)
to replace the `FileSystem` with a mock which throws `AccessControlException`
for specific files.
`invokePrivate` allows reading a value, but doesn't allow to replace replace
it on a spy. This is the same pattern used for the existing `fs` field.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]