HADOOP-15370. S3A log message on rm s3a://bucket/ not intuitive. Contributed by Gabor Bota.

This commit is contained in:
Sean Mackrory 2018-11-26 08:54:39 -07:00
parent 3ce99e32f7
commit 5d96b74f33
1 changed files with 6 additions and 2 deletions

View File

@ -1826,16 +1826,20 @@ public class S3AFileSystem extends FileSystem implements StreamCapabilities {
*/ */
private boolean rejectRootDirectoryDelete(S3AFileStatus status, private boolean rejectRootDirectoryDelete(S3AFileStatus status,
boolean recursive) throws IOException { boolean recursive) throws IOException {
LOG.info("s3a delete the {} root directory of {}", bucket, recursive); LOG.info("s3a delete the {} root directory. Path: {}. Recursive: {}",
bucket, status.getPath(), recursive);
boolean emptyRoot = status.isEmptyDirectory() == Tristate.TRUE; boolean emptyRoot = status.isEmptyDirectory() == Tristate.TRUE;
if (emptyRoot) { if (emptyRoot) {
return true; return true;
} }
if (recursive) { if (recursive) {
LOG.error("Cannot delete root path: {}", status.getPath());
return false; return false;
} else { } else {
// reject // reject
throw new PathIOException(bucket, "Cannot delete root path"); String msg = "Cannot delete root path: " + status.getPath();
LOG.error(msg);
throw new PathIOException(bucket, msg);
} }
} }