HADOOP-12055. Deprecate usage of NativeIO#link. Contributed by Andrew Wang.

(cherry picked from commit e46cb80002)
This commit is contained in:
cnauroth 2015-06-06 09:17:03 -07:00
parent 1a6cdf97bb
commit 1d1841d40f
3 changed files with 14 additions and 1 deletions

View File

@ -150,6 +150,8 @@ Release 2.8.0 - UNRELEASED
HADOOP-12056. Use DirectoryStream in DiskChecker#checkDirs to detect HADOOP-12056. Use DirectoryStream in DiskChecker#checkDirs to detect
errors when listing a directory. (Zhihai Xu via wang) errors when listing a directory. (Zhihai Xu via wang)
HADOOP-12055. Deprecate usage of NativeIO#link. (Andrew Wang via cnauroth)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp HADOOP-11785. Reduce the number of listStatus operation in distcp

View File

@ -881,6 +881,17 @@ public class NativeIO {
} }
} }
/**
* Creates a hardlink "dst" that points to "src".
*
* This is deprecated since JDK7 NIO can create hardlinks via the
* {@link java.nio.file.Files} API.
*
* @param src source file
* @param dst hardlink location
* @throws IOException
*/
@Deprecated
public static void link(File src, File dst) throws IOException { public static void link(File src, File dst) throws IOException {
if (!nativeLoaded) { if (!nativeLoaded) {
HardLink.createHardLink(src, dst); HardLink.createHardLink(src, dst);

View File

@ -1044,7 +1044,7 @@ public class DataStorage extends Storage {
idBasedLayoutSingleLinks.size()); idBasedLayoutSingleLinks.size());
for (int j = iCopy; j < upperBound; j++) { for (int j = iCopy; j < upperBound; j++) {
LinkArgs cur = idBasedLayoutSingleLinks.get(j); LinkArgs cur = idBasedLayoutSingleLinks.get(j);
NativeIO.link(cur.src, cur.dst); HardLink.createHardLink(cur.src, cur.dst);
} }
return null; return null;
} }