HADOOP-15748. S3 listing inconsistency can raise NPE in globber.

Contributed by Steve Loughran.

(cherry picked from commit 646874c326)
This commit is contained in:
Steve Loughran 2018-09-20 13:05:46 +01:00
parent 2aa3854633
commit 9dc180d14a
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0
1 changed files with 12 additions and 1 deletions

View File

@ -245,7 +245,18 @@ class Globber {
// incorrectly conclude that /a/b was a file and should not match // incorrectly conclude that /a/b was a file and should not match
// /a/*/*. So we use getFileStatus of the path we just listed to // /a/*/*. So we use getFileStatus of the path we just listed to
// disambiguate. // disambiguate.
if (!getFileStatus(candidate.getPath()).isDirectory()) { Path path = candidate.getPath();
FileStatus status = getFileStatus(path);
if (status == null) {
// null means the file was not found
LOG.warn("File/directory {} not found:"
+ " it may have been deleted."
+ " If this is an object store, this can be a sign of"
+ " eventual consistency problems.",
path);
continue;
}
if (!status.isDirectory()) {
continue; continue;
} }
} }