|
@@ -186,12 +186,13 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
if (file == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
|
|
|
+ return getFileBlockLocations(file.getPath(), start, len);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public BlockLocation[] getFileBlockLocations(Path p,
|
|
|
long start, long len) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return dfs.getBlockLocations(getPathName(p), start, len);
|
|
|
|
|
|
}
|
|
@@ -204,6 +205,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@SuppressWarnings("deprecation")
|
|
|
@Override
|
|
|
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return new DFSClient.DFSDataInputStream(
|
|
|
dfs.open(getPathName(f), bufferSize, verifyChecksum, statistics));
|
|
|
}
|
|
@@ -213,6 +215,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
public FSDataOutputStream append(Path f, int bufferSize,
|
|
|
Progressable progress) throws IOException {
|
|
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
DFSOutputStream op = (DFSOutputStream)dfs.append(getPathName(f), bufferSize, progress);
|
|
|
return new FSDataOutputStream(op, statistics, op.getInitialLen());
|
|
|
}
|
|
@@ -221,7 +224,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
public FSDataOutputStream create(Path f, FsPermission permission,
|
|
|
boolean overwrite, int bufferSize, short replication, long blockSize,
|
|
|
Progressable progress) throws IOException {
|
|
|
-
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return new FSDataOutputStream(dfs.create(getPathName(f), permission,
|
|
|
overwrite ? EnumSet.of(CreateFlag.OVERWRITE) : EnumSet.of(CreateFlag.CREATE),
|
|
|
replication, blockSize, progress, bufferSize),
|
|
@@ -234,6 +237,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
FsPermission absolutePermission, EnumSet<CreateFlag> flag, int bufferSize,
|
|
|
short replication, long blockSize, Progressable progress,
|
|
|
int bytesPerChecksum) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return new FSDataOutputStream(dfs.primitiveCreate(getPathName(f),
|
|
|
absolutePermission, flag, true, replication, blockSize,
|
|
|
progress, bufferSize, bytesPerChecksum),statistics);
|
|
@@ -245,7 +249,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
|
EnumSet<CreateFlag> flag, int bufferSize, short replication,
|
|
|
long blockSize, Progressable progress) throws IOException {
|
|
|
-
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return new FSDataOutputStream(dfs.create(getPathName(f), permission, flag,
|
|
|
false, replication, blockSize, progress, bufferSize), statistics);
|
|
|
}
|
|
@@ -254,6 +258,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
public boolean setReplication(Path src,
|
|
|
short replication
|
|
|
) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return dfs.setReplication(getPathName(src), replication);
|
|
|
}
|
|
|
|
|
@@ -271,6 +276,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
for(int i=0; i<psrcs.length; i++) {
|
|
|
srcs[i] = getPathName(psrcs[i]);
|
|
|
}
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
dfs.concat(getPathName(trg), srcs);
|
|
|
}
|
|
|
|
|
@@ -278,6 +284,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@SuppressWarnings("deprecation")
|
|
|
@Override
|
|
|
public boolean rename(Path src, Path dst) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return dfs.rename(getPathName(src), getPathName(dst));
|
|
|
}
|
|
|
|
|
@@ -288,17 +295,20 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@SuppressWarnings("deprecation")
|
|
|
@Override
|
|
|
public void rename(Path src, Path dst, Options.Rename... options) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
dfs.rename(getPathName(src), getPathName(dst), options);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean delete(Path f, boolean recursive) throws IOException {
|
|
|
- return dfs.delete(getPathName(f), recursive);
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
+ return dfs.delete(getPathName(f), recursive);
|
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
|
@Override
|
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return dfs.getContentSummary(getPathName(f));
|
|
|
}
|
|
|
|
|
@@ -345,6 +355,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
for (int i = 0; i < partialListing.length; i++) {
|
|
|
stats[i] = makeQualified(partialListing[i], p);
|
|
|
}
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return stats;
|
|
|
}
|
|
|
|
|
@@ -358,6 +369,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
|
listing.add(makeQualified(fileStatus, p));
|
|
|
}
|
|
|
+ statistics.incrementLargeReadOps(1);
|
|
|
|
|
|
// now fetch more entries
|
|
|
do {
|
|
@@ -371,6 +383,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
|
listing.add(makeQualified(fileStatus, p));
|
|
|
}
|
|
|
+ statistics.incrementLargeReadOps(1);
|
|
|
} while (thisListing.hasMore());
|
|
|
|
|
|
return listing.toArray(new FileStatus[listing.size()]);
|
|
@@ -381,11 +394,13 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
* parent directory exists.
|
|
|
*/
|
|
|
public boolean mkdir(Path f, FsPermission permission) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return dfs.mkdirs(getPathName(f), permission, false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return dfs.mkdirs(getPathName(f), permission, true);
|
|
|
}
|
|
|
|
|
@@ -393,6 +408,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@Override
|
|
|
protected boolean primitiveMkdir(Path f, FsPermission absolutePermission)
|
|
|
throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
return dfs.primitiveMkdir(getPathName(f), absolutePermission);
|
|
|
}
|
|
|
|
|
@@ -436,6 +452,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
/** {@inheritDoc} */
|
|
|
@Override
|
|
|
public FsStatus getStatus(Path p) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return dfs.getDiskStatus();
|
|
|
}
|
|
|
|
|
@@ -617,6 +634,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
*/
|
|
|
@Override
|
|
|
public FileStatus getFileStatus(Path f) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
HdfsFileStatus fi = dfs.getFileInfo(getPathName(f));
|
|
|
if (fi != null) {
|
|
|
return makeQualified(fi, f);
|
|
@@ -628,6 +646,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
/** {@inheritDoc} */
|
|
|
@Override
|
|
|
public MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException {
|
|
|
+ statistics.incrementReadOps(1);
|
|
|
return dfs.getFileChecksum(getPathName(f));
|
|
|
}
|
|
|
|
|
@@ -635,6 +654,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@Override
|
|
|
public void setPermission(Path p, FsPermission permission
|
|
|
) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
dfs.setPermission(getPathName(p), permission);
|
|
|
}
|
|
|
|
|
@@ -645,6 +665,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
if (username == null && groupname == null) {
|
|
|
throw new IOException("username == null && groupname == null");
|
|
|
}
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
dfs.setOwner(getPathName(p), username, groupname);
|
|
|
}
|
|
|
|
|
@@ -652,6 +673,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
@Override
|
|
|
public void setTimes(Path p, long mtime, long atime
|
|
|
) throws IOException {
|
|
|
+ statistics.incrementWriteOps(1);
|
|
|
dfs.setTimes(getPathName(p), mtime, atime);
|
|
|
}
|
|
|
|