Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
HDFS-13747. Statistic for list_located_status is incremented incorrec…
Browse files Browse the repository at this point in the history
…tly by listStatusIterator. Contributed by Antal Mihalyi.
  • Loading branch information
xiao-chen committed Aug 17, 2018
1 parent 1697a02 commit c67b065
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,11 @@ private DirListingIterator(Path p, PathFilter filter,
thisListing = dfs.listPaths(src, HdfsFileStatus.EMPTY_NAME,
needLocation);
statistics.incrementReadOps(1);
storageStatistics.incrementOpCounter(OpType.LIST_LOCATED_STATUS);
if (needLocation) {
storageStatistics.incrementOpCounter(OpType.LIST_LOCATED_STATUS);
} else {
storageStatistics.incrementOpCounter(OpType.LIST_STATUS);
}
if (thisListing == null) { // the directory does not exist
throw new FileNotFoundException("File " + p + " does not exist.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ public void testStatistics() throws IOException {
// Iterative ls test
long mkdirOp = getOpStatistics(OpType.MKDIRS);
long listStatusOp = getOpStatistics(OpType.LIST_STATUS);
long locatedListStatusOP = getOpStatistics(OpType.LIST_LOCATED_STATUS);
for (int i = 0; i < 10; i++) {
Path p = new Path(dir, Integer.toString(i));
fs.mkdirs(p);
Expand All @@ -729,6 +730,12 @@ public void testStatistics() throws IOException {
checkStatistics(fs, readOps, ++writeOps, largeReadOps);
checkOpStatistics(OpType.MKDIRS, mkdirOp);
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);
Expand Down

0 comments on commit c67b065

Please sign in to comment.