HADOOP-13321. Deprecate FileSystem APIs that promote inefficient call patterns. Contributed by Chris Nauroth and Mingliang Liu
This commit is contained in:
parent
a207aa9930
commit
a4d4a23785
|
@ -605,6 +605,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem {
|
||||||
* Rename files/dirs
|
* Rename files/dirs
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean rename(Path src, Path dst) throws IOException {
|
public boolean rename(Path src, Path dst) throws IOException {
|
||||||
if (fs.isDirectory(src)) {
|
if (fs.isDirectory(src)) {
|
||||||
return fs.rename(src, dst);
|
return fs.rename(src, dst);
|
||||||
|
@ -721,6 +722,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem {
|
||||||
* If src and dst are directories, the copyCrc parameter
|
* If src and dst are directories, the copyCrc parameter
|
||||||
* determines whether to copy CRC files.
|
* determines whether to copy CRC files.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void copyToLocalFile(Path src, Path dst, boolean copyCrc)
|
public void copyToLocalFile(Path src, Path dst, boolean copyCrc)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (!fs.isDirectory(src)) { // source is a file
|
if (!fs.isDirectory(src)) { // source is a file
|
||||||
|
|
|
@ -1624,6 +1624,11 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if a path exists.
|
/** 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
|
* @param f source path
|
||||||
* @return true if the path exists
|
* @return true if the path exists
|
||||||
* @throws IOException IO failure
|
* @throws IOException IO failure
|
||||||
|
@ -1639,9 +1644,12 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
/** True iff the named path is a directory.
|
/** True iff the named path is a directory.
|
||||||
* Note: Avoid using this method. Instead reuse the FileStatus
|
* Note: Avoid using this method. Instead reuse the FileStatus
|
||||||
* returned by getFileStatus() or listStatus() methods.
|
* returned by getFileStatus() or listStatus() methods.
|
||||||
|
*
|
||||||
* @param f path to check
|
* @param f path to check
|
||||||
* @throws IOException IO failure
|
* @throws IOException IO failure
|
||||||
|
* @deprecated Use {@link #getFileStatus(Path)} instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isDirectory(Path f) throws IOException {
|
public boolean isDirectory(Path f) throws IOException {
|
||||||
try {
|
try {
|
||||||
return getFileStatus(f).isDirectory();
|
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.
|
/** True iff the named path is a regular file.
|
||||||
* Note: Avoid using this method. Instead reuse the FileStatus
|
* Note: Avoid using this method. Instead reuse the FileStatus
|
||||||
* returned by {@link #getFileStatus(Path)} or listStatus() methods.
|
* returned by {@link #getFileStatus(Path)} or listStatus() methods.
|
||||||
|
*
|
||||||
* @param f path to check
|
* @param f path to check
|
||||||
* @throws IOException IO failure
|
* @throws IOException IO failure
|
||||||
|
* @deprecated Use {@link #getFileStatus(Path)} instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isFile(Path f) throws IOException {
|
public boolean isFile(Path f) throws IOException {
|
||||||
try {
|
try {
|
||||||
return getFileStatus(f).isFile();
|
return getFileStatus(f).isFile();
|
||||||
|
|
|
@ -644,6 +644,7 @@ public class FTPFileSystem extends FileSystem {
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private boolean rename(FTPClient client, Path src, Path dst)
|
private boolean rename(FTPClient client, Path src, Path dst)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Path workDir = new Path(client.printWorkingDirectory());
|
Path workDir = new Path(client.printWorkingDirectory());
|
||||||
|
|
|
@ -2142,6 +2142,7 @@ public class S3AFileSystem extends FileSystem {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean isDirectory(Path f) throws IOException {
|
public boolean isDirectory(Path f) throws IOException {
|
||||||
incrementStatistic(INVOCATION_IS_DIRECTORY);
|
incrementStatistic(INVOCATION_IS_DIRECTORY);
|
||||||
return super.isDirectory(f);
|
return super.isDirectory(f);
|
||||||
|
@ -2152,6 +2153,7 @@ public class S3AFileSystem extends FileSystem {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean isFile(Path f) throws IOException {
|
public boolean isFile(Path f) throws IOException {
|
||||||
incrementStatistic(INVOCATION_IS_FILE);
|
incrementStatistic(INVOCATION_IS_FILE);
|
||||||
return super.isFile(f);
|
return super.isFile(f);
|
||||||
|
|
|
@ -201,6 +201,7 @@ public class SwiftNativeFileSystem extends FileSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean isFile(Path f) throws IOException {
|
public boolean isFile(Path f) throws IOException {
|
||||||
try {
|
try {
|
||||||
FileStatus fileStatus = getFileStatus(f);
|
FileStatus fileStatus = getFileStatus(f);
|
||||||
|
@ -210,6 +211,7 @@ public class SwiftNativeFileSystem extends FileSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean isDirectory(Path f) throws IOException {
|
public boolean isDirectory(Path f) throws IOException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue