diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java index e0ce327a0f..14c190553a 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java @@ -605,6 +605,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem { * Rename files/dirs */ @Override + @SuppressWarnings("deprecation") public boolean rename(Path src, Path dst) throws IOException { if (fs.isDirectory(src)) { return fs.rename(src, dst); @@ -721,6 +722,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem { * If src and dst are directories, the copyCrc parameter * determines whether to copy CRC files. */ + @SuppressWarnings("deprecation") public void copyToLocalFile(Path src, Path dst, boolean copyCrc) throws IOException { if (!fs.isDirectory(src)) { // source is a file diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index 55cd97e643..ededfa9810 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -1624,6 +1624,11 @@ public abstract class FileSystem extends Configured implements Closeable { } /** Check if a path exists. + * + * It is highly discouraged to call this method back to back with other + * {@link #getFileStatus(Path)} calls, as this will involve multiple redundant + * RPC calls in HDFS. + * * @param f source path * @return true if the path exists * @throws IOException IO failure @@ -1639,9 +1644,12 @@ public abstract class FileSystem extends Configured implements Closeable { /** True iff the named path is a directory. * Note: Avoid using this method. Instead reuse the FileStatus * returned by getFileStatus() or listStatus() methods. + * * @param f path to check * @throws IOException IO failure + * @deprecated Use {@link #getFileStatus(Path)} instead */ + @Deprecated public boolean isDirectory(Path f) throws IOException { try { return getFileStatus(f).isDirectory(); @@ -1653,9 +1661,12 @@ public abstract class FileSystem extends Configured implements Closeable { /** True iff the named path is a regular file. * Note: Avoid using this method. Instead reuse the FileStatus * returned by {@link #getFileStatus(Path)} or listStatus() methods. + * * @param f path to check * @throws IOException IO failure + * @deprecated Use {@link #getFileStatus(Path)} instead */ + @Deprecated public boolean isFile(Path f) throws IOException { try { return getFileStatus(f).isFile(); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java index 25fec31ca0..6ce39c16a9 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java @@ -644,6 +644,7 @@ public class FTPFileSystem extends FileSystem { * @return * @throws IOException */ + @SuppressWarnings("deprecation") private boolean rename(FTPClient client, Path src, Path dst) throws IOException { Path workDir = new Path(client.printWorkingDirectory()); diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java index 8b1a6d082e..bc4791834b 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java @@ -2142,6 +2142,7 @@ public class S3AFileSystem extends FileSystem { * {@inheritDoc} */ @Override + @SuppressWarnings("deprecation") public boolean isDirectory(Path f) throws IOException { incrementStatistic(INVOCATION_IS_DIRECTORY); return super.isDirectory(f); @@ -2152,6 +2153,7 @@ public class S3AFileSystem extends FileSystem { * {@inheritDoc} */ @Override + @SuppressWarnings("deprecation") public boolean isFile(Path f) throws IOException { incrementStatistic(INVOCATION_IS_FILE); return super.isFile(f); diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystem.java b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystem.java index 7f93c38785..9217532333 100644 --- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystem.java +++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystem.java @@ -201,6 +201,7 @@ public class SwiftNativeFileSystem extends FileSystem { } @Override + @SuppressWarnings("deprecation") public boolean isFile(Path f) throws IOException { try { FileStatus fileStatus = getFileStatus(f); @@ -210,6 +211,7 @@ public class SwiftNativeFileSystem extends FileSystem { } } + @SuppressWarnings("deprecation") @Override public boolean isDirectory(Path f) throws IOException {