You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ra...@apache.org on 2008/04/15 20:01:52 UTC
svn commit: r648357 - in /hadoop/core/trunk: ./
src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/
src/java/org/apache/hadoop/fs/kfs/ src/java/org/apache/hadoop/mapred/
src/test/org/apache/hadoop/dfs/
Author: rangadi
Date: Tue Apr 15 11:01:39 2008
New Revision: 648357
URL: http://svn.apache.org/viewvc?rev=648357&view=rev
Log:
HADOOP-2928. Remove deprecated FileSystem.getContentLength(). (Lohit Vjayarenu via rangadi)
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ChecksumDistributedFileSystem.java
hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MultiFileInputFormat.java
hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java
hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileStatus.java
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Apr 15 11:01:39 2008
@@ -14,6 +14,9 @@
accessible via a NFS mount. (shv)
IMPROVEMENTS
+
+ HADOOP-2928. Remove deprecated FileSystem.getContentLength().
+ (Lohit Vjayarenu via rangadi)
OPTIMIZATIONS
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ChecksumDistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ChecksumDistributedFileSystem.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ChecksumDistributedFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ChecksumDistributedFileSystem.java Tue Apr 15 11:01:39 2008
@@ -49,11 +49,6 @@
return (DistributedFileSystem)fs;
}
- @Override
- public long getContentLength(Path f) throws IOException {
- return fs.getContentLength(f);
- }
-
/** Return the total raw capacity of the filesystem, disregarding
* replication .*/
public long getRawCapacity() throws IOException{
@@ -128,4 +123,4 @@
return getDFS().getFileStatus(f);
}
-}
\ No newline at end of file
+}
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java Tue Apr 15 11:01:39 2008
@@ -171,21 +171,6 @@
}
/** {@inheritDoc} */
- @Deprecated
- public long getContentLength(Path f) throws IOException {
- // If it is a directory, then issue a getContentLength
- // RPC to find the size of the entire subtree in one call.
- //
- if (f instanceof DfsPath) {
- DfsPath dfspath = (DfsPath)f;
- if (!dfspath.isDirectory()) {
- return dfspath.getContentsLength();
- }
- }
- return getContentSummary(f).getLength();
- }
-
- /** {@inheritDoc} */
public ContentSummary getContentSummary(Path f) throws IOException {
return dfs.getContentSummary(getPathName(f));
}
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java Tue Apr 15 11:01:39 2008
@@ -215,7 +215,7 @@
/* Return the file length */
private long getFileLength() throws IOException {
if( fileLen==-1L ) {
- fileLen = fs.getContentLength(file);
+ fileLen = fs.getContentSummary(file).getLength();
}
return fileLen;
}
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Tue Apr 15 11:01:39 2008
@@ -628,16 +628,6 @@
return getFileStatus(f).getLen();
}
- /** Return the number of bytes of the given path
- * If <i>f</i> is a file, return the size of the file;
- * If <i>f</i> is a directory, return the size of the directory tree
- * @deprecated Use {@link #getContentSummary(Path)}.
- */
- @Deprecated
- public long getContentLength(Path f) throws IOException {
- return getContentSummary(f).getLength();
- }
-
/** Return the {@link ContentSummary} of a given {@link Path}. */
public ContentSummary getContentSummary(Path f) throws IOException {
FileStatus status = getFileStatus(f);
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java Tue Apr 15 11:01:39 2008
@@ -694,17 +694,9 @@
": No such file or directory.");
}
for(int i=0; i<status.length; i++) {
- FileStatus items[] = srcFs.listStatus(status[i].getPath());
- if (items != null) {
- long totalSize=0;
- for(int j=0; j<items.length; j++) {
- totalSize += srcFs.getContentLength(
- items[j].getPath());
- }
- String pathStr = status[i].getPath().toString();
- System.out.println(
- ("".equals(pathStr)?".":pathStr) + "\t" + totalSize);
- }
+ long totalSize = srcFs.getContentSummary(status[i].getPath()).getLength();
+ String pathStr = status[i].getPath().toString();
+ System.out.println(("".equals(pathStr)?".":pathStr) + "\t" + totalSize);
}
}
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java Tue Apr 15 11:01:39 2008
@@ -127,29 +127,6 @@
return kfsImpl.isFile(srep);
}
- public long getContentLength(Path path) throws IOException {
- Path absolute = makeAbsolute(path);
- String srep = absolute.toUri().getPath();
-
- if (kfsImpl.isFile(srep))
- return kfsImpl.filesize(srep);
-
- String[] entries = kfsImpl.readdir(srep);
-
- if (entries == null)
- return 0;
-
- // kfsreaddir() returns "." and ".."; strip them before
- // passing back to hadoop fs.
- long numEntries = 0;
- for (int i = 0; i < entries.length; i++) {
- if ((entries[i].compareTo(".") == 0) || (entries[i].compareTo("..") == 0))
- continue;
- numEntries++;
- }
- return numEntries;
- }
-
public FileStatus[] listStatus(Path path) throws IOException {
Path absolute = makeAbsolute(path);
String srep = absolute.toUri().getPath();
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MultiFileInputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MultiFileInputFormat.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MultiFileInputFormat.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MultiFileInputFormat.java Tue Apr 15 11:01:39 2008
@@ -49,7 +49,7 @@
long totLength = 0;
for(int i=0; i<paths.length; i++) {
FileSystem fs = paths[i].getFileSystem(job);
- lengths[i] = fs.getContentLength(paths[i]);
+ lengths[i] = fs.getContentSummary(paths[i]).getLength();
totLength += lengths[i];
}
double avgLengthPerSplit = ((double)totLength) / numSplits;
Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java Tue Apr 15 11:01:39 2008
@@ -657,7 +657,7 @@
}
/* A class that verifies the permission checking is correct for isDirectory,
- * exist, getFileInfo, getContentLength */
+ * exist, getFileInfo, getContentSummary */
private class StatsPermissionVerifier extends PermissionVerifier {
OpType opType;
@@ -668,7 +668,7 @@
setOpType(opType);
}
- /* set if operation is getFileInfo, isDirectory, exist, getContenLength */
+ /* set if operation is getFileInfo, isDirectory, exist, getContenSummary */
void setOpType(OpType opType) {
this.opType = opType;
}
@@ -691,7 +691,7 @@
fs.exists(path);
break;
case GET_CONTENT_LENGTH:
- fs.getContentLength(path);
+ fs.getContentSummary(path).getLength();
break;
default:
throw new IllegalArgumentException("Unexpected operation type: "
@@ -702,7 +702,7 @@
private StatsPermissionVerifier statsVerifier = new StatsPermissionVerifier();
/* test if the permission checking of isDirectory, exist,
- * getFileInfo, getContentLength is correct */
+ * getFileInfo, getContentSummary is correct */
private void testStats(UnixUserGroupInformation ugi, Path path,
short ancestorPermission, short parentPermission) throws Exception {
statsVerifier.set(path, OpType.GET_FILEINFO, ancestorPermission,
@@ -933,7 +933,7 @@
checkNoPermissionDeny(e);
}
try {
- fs.getContentLength(NON_EXISTENT_FILE);
+ fs.getContentSummary(NON_EXISTENT_FILE).getLength();
} catch (IOException e) {
checkNoPermissionDeny(e);
}
Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileStatus.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileStatus.java?rev=648357&r1=648356&r2=648357&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileStatus.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileStatus.java Tue Apr 15 11:01:39 2008
@@ -111,7 +111,6 @@
assertTrue(fs.getFileStatus(file1).getBlockSize() == blockSize);
assertTrue(fs.getFileStatus(file1).getReplication() == 1);
assertTrue(fs.getFileStatus(file1).getLen() == fileSize);
- assertTrue(fs.getContentLength(file1) == fileSize);
System.out.println("Path : \"" + file1 + "\"");
// create an empty directory
@@ -123,7 +122,7 @@
assertTrue(dir + " should be a directory",
fs.getFileStatus(path).isDir() == true);
assertTrue(dir + " should be zero size ",
- fs.getContentLength(dir) == 0);
+ fs.getContentSummary(dir).getLength() == 0);
assertTrue(dir + " should be zero size ",
fs.getFileStatus(dir).getLen() == 0);
System.out.println("Dir : \"" + dir + "\"");
@@ -151,7 +150,7 @@
// verify that the size of the directory increased by the size
// of the two files
assertTrue(dir + " size should be " + (blockSize/2),
- blockSize/2 == fs.getContentLength(dir));
+ blockSize/2 == fs.getContentSummary(dir).getLength());
} finally {
fs.close();
cluster.shutdown();