-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-29999][SS][FOLLOWUP] Fix test to check the actual metadata log directory #28930
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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,8 +45,7 @@ object FileStreamSink extends Logging { | |
| val hdfsPath = new Path(singlePath) | ||
| val fs = hdfsPath.getFileSystem(hadoopConf) | ||
| if (fs.isDirectory(hdfsPath)) { | ||
| val metadataPath = new Path(hdfsPath, metadataDir) | ||
| checkEscapedMetadataPath(fs, metadataPath, sqlConf) | ||
| val metadataPath = getMetadataLogPath(hdfsPath, hadoopConf, sqlConf) | ||
| fs.exists(metadataPath) | ||
| } else { | ||
| false | ||
|
|
@@ -55,6 +54,13 @@ object FileStreamSink extends Logging { | |
| } | ||
| } | ||
|
|
||
| def getMetadataLogPath(path: Path, hadoopConf: Configuration, sqlConf: SQLConf): Path = { | ||
| val metadataDir = new Path(path, FileStreamSink.metadataDir) | ||
| val fs = metadataDir.getFileSystem(hadoopConf) | ||
| FileStreamSink.checkEscapedMetadataPath(fs, metadataDir, sqlConf) | ||
|
Contributor
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 is new code. So this PR fixes a bug instead of just fixing a test?
Contributor
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. Oh sorry I should have explained before. That's to avoid test to copy same code (logic) what FileStreamSink does, so that we don't break the test when we somehow change it. So that's a refactor and doesn't mean there's a bug in FileStreamSink. |
||
| metadataDir | ||
| } | ||
|
|
||
| def checkEscapedMetadataPath(fs: FileSystem, metadataPath: Path, sqlConf: SQLConf): Unit = { | ||
| if (sqlConf.getConf(SQLConf.STREAMING_CHECKPOINT_ESCAPED_PATH_CHECK_ENABLED) | ||
| && StreamExecution.containsSpecialCharsInPath(metadataPath)) { | ||
|
|
@@ -125,14 +131,11 @@ class FileStreamSink( | |
| partitionColumnNames: Seq[String], | ||
| options: Map[String, String]) extends Sink with Logging { | ||
|
|
||
| import FileStreamSink._ | ||
|
|
||
| private val hadoopConf = sparkSession.sessionState.newHadoopConf() | ||
| private val basePath = new Path(path) | ||
| private val logPath = { | ||
| val metadataDir = new Path(basePath, FileStreamSink.metadataDir) | ||
| val fs = metadataDir.getFileSystem(hadoopConf) | ||
| FileStreamSink.checkEscapedMetadataPath(fs, metadataDir, sparkSession.sessionState.conf) | ||
| metadataDir | ||
| } | ||
| private val logPath = getMetadataLogPath(basePath, hadoopConf, sparkSession.sessionState.conf) | ||
| private val fileLog = | ||
| new FileStreamSinkLog(FileStreamSinkLog.VERSION, sparkSession, logPath.toString) | ||
|
|
||
|
|
||
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.
shall we pass the
fsas a parameter as well?