|
@@ -174,6 +174,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
if (file == null) {
|
|
if (file == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
|
|
return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -182,6 +183,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
|
|
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
return new DFSClient.DFSDataInputStream(
|
|
return new DFSClient.DFSDataInputStream(
|
|
dfs.open(getPathName(f), bufferSize, verifyChecksum, statistics));
|
|
dfs.open(getPathName(f), bufferSize, verifyChecksum, statistics));
|
|
}
|
|
}
|
|
@@ -190,6 +192,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
public FSDataOutputStream append(Path f, int bufferSize,
|
|
public FSDataOutputStream append(Path f, int bufferSize,
|
|
Progressable progress) throws IOException {
|
|
Progressable progress) throws IOException {
|
|
|
|
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
DFSOutputStream op = (DFSOutputStream)dfs.append(getPathName(f), bufferSize, progress);
|
|
DFSOutputStream op = (DFSOutputStream)dfs.append(getPathName(f), bufferSize, progress);
|
|
return new FSDataOutputStream(op, statistics, op.getInitialLen());
|
|
return new FSDataOutputStream(op, statistics, op.getInitialLen());
|
|
}
|
|
}
|
|
@@ -199,6 +202,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
int bufferSize, short replication, long blockSize,
|
|
int bufferSize, short replication, long blockSize,
|
|
Progressable progress) throws IOException {
|
|
Progressable progress) throws IOException {
|
|
|
|
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
return new FSDataOutputStream
|
|
return new FSDataOutputStream
|
|
(dfs.create(getPathName(f), permission,
|
|
(dfs.create(getPathName(f), permission,
|
|
overwrite, replication, blockSize, progress, bufferSize),
|
|
overwrite, replication, blockSize, progress, bufferSize),
|
|
@@ -208,6 +212,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
public boolean setReplication(Path src,
|
|
public boolean setReplication(Path src,
|
|
short replication
|
|
short replication
|
|
) throws IOException {
|
|
) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
return dfs.setReplication(getPathName(src), replication);
|
|
return dfs.setReplication(getPathName(src), replication);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -215,6 +220,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
* Rename files/dirs
|
|
* Rename files/dirs
|
|
*/
|
|
*/
|
|
public boolean rename(Path src, Path dst) throws IOException {
|
|
public boolean rename(Path src, Path dst) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
return dfs.rename(getPathName(src), getPathName(dst));
|
|
return dfs.rename(getPathName(src), getPathName(dst));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -223,6 +229,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
*/
|
|
*/
|
|
@Deprecated
|
|
@Deprecated
|
|
public boolean delete(Path f) throws IOException {
|
|
public boolean delete(Path f) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
return dfs.delete(getPathName(f));
|
|
return dfs.delete(getPathName(f));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -231,11 +238,13 @@ public class DistributedFileSystem extends FileSystem {
|
|
* empty directory recursively.
|
|
* empty directory recursively.
|
|
*/
|
|
*/
|
|
public boolean delete(Path f, boolean recursive) throws IOException {
|
|
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} */
|
|
/** {@inheritDoc} */
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
return dfs.getContentSummary(getPathName(f));
|
|
return dfs.getContentSummary(getPathName(f));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -281,6 +290,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
for (int i = 0; i < partialListing.length; i++) {
|
|
for (int i = 0; i < partialListing.length; i++) {
|
|
stats[i] = makeQualified(partialListing[i], p);
|
|
stats[i] = makeQualified(partialListing[i], p);
|
|
}
|
|
}
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
return stats;
|
|
return stats;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -294,6 +304,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
listing.add(makeQualified(fileStatus, p));
|
|
listing.add(makeQualified(fileStatus, p));
|
|
}
|
|
}
|
|
|
|
+ statistics.incrementLargeReadOps(1);
|
|
|
|
|
|
// now fetch more entries
|
|
// now fetch more entries
|
|
do {
|
|
do {
|
|
@@ -307,12 +318,14 @@ public class DistributedFileSystem extends FileSystem {
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
for (HdfsFileStatus fileStatus : partialListing) {
|
|
listing.add(makeQualified(fileStatus, p));
|
|
listing.add(makeQualified(fileStatus, p));
|
|
}
|
|
}
|
|
|
|
+ statistics.incrementLargeReadOps(1);
|
|
} while (thisListing.hasMore());
|
|
} while (thisListing.hasMore());
|
|
|
|
|
|
return listing.toArray(new FileStatus[listing.size()]);
|
|
return listing.toArray(new FileStatus[listing.size()]);
|
|
}
|
|
}
|
|
|
|
|
|
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
|
|
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
return dfs.mkdirs(getPathName(f), permission);
|
|
return dfs.mkdirs(getPathName(f), permission);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -504,6 +517,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
* @throws FileNotFoundException if the file does not exist.
|
|
* @throws FileNotFoundException if the file does not exist.
|
|
*/
|
|
*/
|
|
public FileStatus getFileStatus(Path f) throws IOException {
|
|
public FileStatus getFileStatus(Path f) throws IOException {
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
HdfsFileStatus fi = dfs.getFileInfo(getPathName(f));
|
|
HdfsFileStatus fi = dfs.getFileInfo(getPathName(f));
|
|
if (fi != null) {
|
|
if (fi != null) {
|
|
return makeQualified(fi, f);
|
|
return makeQualified(fi, f);
|
|
@@ -514,12 +528,14 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
public MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException {
|
|
public MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException {
|
|
|
|
+ statistics.incrementReadOps(1);
|
|
return dfs.getFileChecksum(getPathName(f));
|
|
return dfs.getFileChecksum(getPathName(f));
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc }*/
|
|
/** {@inheritDoc }*/
|
|
public void setPermission(Path p, FsPermission permission
|
|
public void setPermission(Path p, FsPermission permission
|
|
) throws IOException {
|
|
) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
dfs.setPermission(getPathName(p), permission);
|
|
dfs.setPermission(getPathName(p), permission);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -529,12 +545,14 @@ public class DistributedFileSystem extends FileSystem {
|
|
if (username == null && groupname == null) {
|
|
if (username == null && groupname == null) {
|
|
throw new IOException("username == null && groupname == null");
|
|
throw new IOException("username == null && groupname == null");
|
|
}
|
|
}
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
dfs.setOwner(getPathName(p), username, groupname);
|
|
dfs.setOwner(getPathName(p), username, groupname);
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc }*/
|
|
/** {@inheritDoc }*/
|
|
public void setTimes(Path p, long mtime, long atime
|
|
public void setTimes(Path p, long mtime, long atime
|
|
) throws IOException {
|
|
) throws IOException {
|
|
|
|
+ statistics.incrementWriteOps(1);
|
|
dfs.setTimes(getPathName(p), mtime, atime);
|
|
dfs.setTimes(getPathName(p), mtime, atime);
|
|
}
|
|
}
|
|
|
|
|