Author: szetszwo
Date: Wed Dec 17 15:11:52 2008
New Revision: 727571
URL: http://svn.apache.org/viewvc?rev=727571&view=rev
Log:
HADOOP-4895. Remove deprecated methods in DFSClient. (szetszwo)
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
hadoop/core/trunk/src/webapps/datanode/browseDirectory.jsp
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=727571&r1=727570&r2=727571&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Dec 17 15:11:52 2008
@@ -4,6 +4,9 @@
INCOMPATIBLE CHANGES
+ HADOOP-4895. Removes deprecated methods DFSClient.getHints(..) and
+ DFSClient.isDirectory(..). (szetszwo)
+
NEW FEATURES
IMPROVEMENTS
Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java?rev=727571&r1=727570&r2=727571&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java Wed Dec 17
15:11:52 2008
@@ -241,37 +241,6 @@
public short getDefaultReplication() {
return defaultReplication;
}
-
- /**
- * @deprecated Use getBlockLocations instead
- *
- * Get hints about the location of the indicated block(s).
- *
- * getHints() returns a list of hostnames that store data for
- * a specific file region. It returns a set of hostnames for
- * every block within the indicated region.
- *
- * This function is very useful when writing code that considers
- * data-placement when performing operations. For example, the
- * MapReduce system tries to schedule tasks on the same machines
- * as the data-block the task processes.
- */
- @Deprecated
- public String[][] getHints(String src, long start, long length)
- throws IOException {
- BlockLocation[] blkLocations = getBlockLocations(src, start, length);
- if ((blkLocations == null) || (blkLocations.length == 0)) {
- return new String[0][];
- }
- int blkCount = blkLocations.length;
- String[][]hints = new String[blkCount][];
- for (int i=0; i < blkCount ; i++) {
- String[] hosts = blkLocations[i].getHosts();
- hints[i] = new String[hosts.length];
- hints[i] = hosts;
- }
- return hints;
- }
private static LocatedBlocks callGetBlockLocations(ClientProtocol namenode,
String src, long start, long length) throws IOException {
@@ -556,18 +525,6 @@
return getFileInfo(src) != null;
}
- /** @deprecated Use getFileStatus() instead */
- @Deprecated
- public boolean isDirectory(String src) throws IOException {
- FileStatus fs = getFileInfo(src);
- if (fs != null)
- return fs.isDir();
- else
- throw new FileNotFoundException("File does not exist: " + src);
- }
-
- /**
- */
public FileStatus[] listPaths(String src) throws IOException {
checkOpen();
try {
Modified:
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java?rev=727571&r1=727570&r2=727571&view=diff
==============================================================================
---
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
(original)
+++
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
Wed Dec 17 15:11:52 2008
@@ -492,14 +492,15 @@
lfInited = true;
try {
String lfName = "/lost+found";
- // check that /lost+found exists
- if (!dfs.exists(lfName)) {
+
+ final FileStatus lfStatus = dfs.getFileInfo(lfName);
+ if (lfStatus == null) { // not exists
lfInitedOk = dfs.mkdirs(lfName);
lostFound = lfName;
- } else if (!dfs.isDirectory(lfName)) {
+ } else if (!lfStatus.isDir()) { // exists but not a directory
LOG.warn("Cannot use /lost+found : a regular file with this name
exists.");
lfInitedOk = false;
- } else { // exists and isDirectory
+ } else { // exists and is a directory
lostFound = lfName;
lfInitedOk = true;
}
Modified: hadoop/core/trunk/src/webapps/datanode/browseDirectory.jsp
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/webapps/datanode/browseDirectory.jsp?rev=727571&r1=727570&r2=727571&view=diff
==============================================================================
--- hadoop/core/trunk/src/webapps/datanode/browseDirectory.jsp (original)
+++ hadoop/core/trunk/src/webapps/datanode/browseDirectory.jsp Wed Dec 17
15:11:52 2008
@@ -36,12 +36,13 @@
DFSClient dfs = new DFSClient(jspHelper.nameNodeAddr, jspHelper.conf);
String target = dir;
- if (!dfs.exists(target)) {
+ final FileStatus targetStatus = dfs.getFileInfo(target);
+ if (targetStatus == null) { // not exists
out.print("<h3>File or directory : " + target + " does not exist</h3>");
JspHelper.printGotoForm(out, namenodeInfoPort, target);
}
else {
- if( !dfs.isDirectory(target) ) { // a file
+ if( !targetStatus.isDir() ) { // a file
List<LocatedBlock> blocks =
dfs.namenode.getBlockLocations(dir, 0, 1).getLocatedBlocks();