-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24364][SS] Prevent InMemoryFileIndex from failing if file path doesn't exist #21408
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 |
|---|---|---|
|
|
@@ -294,9 +294,12 @@ object InMemoryFileIndex extends Logging { | |
| if (filter != null) allFiles.filter(f => filter.accept(f.getPath)) else allFiles | ||
| } | ||
|
|
||
| allLeafStatuses.filterNot(status => shouldFilterOut(status.getPath.getName)).map { | ||
| val missingFiles = mutable.ArrayBuffer.empty[String] | ||
| val filteredLeafStatuses = allLeafStatuses.filterNot( | ||
| status => shouldFilterOut(status.getPath.getName)) | ||
| val resolvedLeafStatuses = filteredLeafStatuses.flatMap { | ||
| case f: LocatedFileStatus => | ||
| f | ||
| Some(f) | ||
|
|
||
| // NOTE: | ||
| // | ||
|
|
@@ -311,14 +314,27 @@ object InMemoryFileIndex extends Logging { | |
| // The other constructor of LocatedFileStatus will call FileStatus.getPermission(), | ||
| // which is very slow on some file system (RawLocalFileSystem, which is launch a | ||
| // subprocess and parse the stdout). | ||
| val locations = fs.getFileBlockLocations(f, 0, f.getLen) | ||
| val lfs = new LocatedFileStatus(f.getLen, f.isDirectory, f.getReplication, f.getBlockSize, | ||
| f.getModificationTime, 0, null, null, null, null, f.getPath, locations) | ||
| if (f.isSymlink) { | ||
| lfs.setSymlink(f.getSymlink) | ||
| try { | ||
|
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. only diff here is try and catch |
||
| val locations = fs.getFileBlockLocations(f, 0, f.getLen) | ||
| val lfs = new LocatedFileStatus(f.getLen, f.isDirectory, f.getReplication, f.getBlockSize, | ||
| f.getModificationTime, 0, null, null, null, null, f.getPath, locations) | ||
| if (f.isSymlink) { | ||
| lfs.setSymlink(f.getSymlink) | ||
| } | ||
| Some(lfs) | ||
| } catch { | ||
| case _: FileNotFoundException => | ||
| missingFiles += f.getPath.toString | ||
| None | ||
| } | ||
| lfs | ||
| } | ||
|
|
||
| if (missingFiles.nonEmpty) { | ||
| logWarning(s"The paths [${missingFiles.mkString(", ")}] were not found. " + | ||
| "Were they deleted very recently?") | ||
|
||
| } | ||
|
|
||
| resolvedLeafStatuses | ||
| } | ||
|
|
||
| /** Checks if we should filter out this path name. */ | ||
|
|
||
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 made this var to reduce the diff.