HDFS-13747. Statistic for list_located_status is incremented incorrectly by listStatusIterator. Contributed by Antal Mihalyi.
(cherry picked from commit c67b0650ea
)
This commit is contained in:
parent
3532bd5c8b
commit
06f0d5e257
|
@ -1217,7 +1217,11 @@ public class DistributedFileSystem extends FileSystem
|
||||||
thisListing = dfs.listPaths(src, HdfsFileStatus.EMPTY_NAME,
|
thisListing = dfs.listPaths(src, HdfsFileStatus.EMPTY_NAME,
|
||||||
needLocation);
|
needLocation);
|
||||||
statistics.incrementReadOps(1);
|
statistics.incrementReadOps(1);
|
||||||
|
if (needLocation) {
|
||||||
storageStatistics.incrementOpCounter(OpType.LIST_LOCATED_STATUS);
|
storageStatistics.incrementOpCounter(OpType.LIST_LOCATED_STATUS);
|
||||||
|
} else {
|
||||||
|
storageStatistics.incrementOpCounter(OpType.LIST_STATUS);
|
||||||
|
}
|
||||||
if (thisListing == null) { // the directory does not exist
|
if (thisListing == null) { // the directory does not exist
|
||||||
throw new FileNotFoundException("File " + p + " does not exist.");
|
throw new FileNotFoundException("File " + p + " does not exist.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,6 +706,7 @@ public class TestDistributedFileSystem {
|
||||||
// Iterative ls test
|
// Iterative ls test
|
||||||
long mkdirOp = getOpStatistics(OpType.MKDIRS);
|
long mkdirOp = getOpStatistics(OpType.MKDIRS);
|
||||||
long listStatusOp = getOpStatistics(OpType.LIST_STATUS);
|
long listStatusOp = getOpStatistics(OpType.LIST_STATUS);
|
||||||
|
long locatedListStatusOP = getOpStatistics(OpType.LIST_LOCATED_STATUS);
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
Path p = new Path(dir, Integer.toString(i));
|
Path p = new Path(dir, Integer.toString(i));
|
||||||
fs.mkdirs(p);
|
fs.mkdirs(p);
|
||||||
|
@ -729,6 +730,12 @@ public class TestDistributedFileSystem {
|
||||||
checkStatistics(fs, readOps, ++writeOps, largeReadOps);
|
checkStatistics(fs, readOps, ++writeOps, largeReadOps);
|
||||||
checkOpStatistics(OpType.MKDIRS, mkdirOp);
|
checkOpStatistics(OpType.MKDIRS, mkdirOp);
|
||||||
checkOpStatistics(OpType.LIST_STATUS, listStatusOp);
|
checkOpStatistics(OpType.LIST_STATUS, listStatusOp);
|
||||||
|
|
||||||
|
fs.listLocatedStatus(dir);
|
||||||
|
locatedListStatusOP++;
|
||||||
|
readOps++;
|
||||||
|
checkStatistics(fs, readOps, writeOps, largeReadOps);
|
||||||
|
checkOpStatistics(OpType.LIST_LOCATED_STATUS, locatedListStatusOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
opCount = getOpStatistics(OpType.GET_STATUS);
|
opCount = getOpStatistics(OpType.GET_STATUS);
|
||||||
|
|
Loading…
Reference in New Issue