From 3826799270d56352d3623a6ff6d4a06c157b26e8 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Mon, 10 Mar 2014 19:05:10 +0000 Subject: [PATCH] HDFS-6070. Cleanup use of ReadStatistics in DFSInputStream. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1576048 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../main/java/org/apache/hadoop/hdfs/DFSInputStream.java | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 8d2b35b1001..4b838086781 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -144,6 +144,8 @@ Release 2.4.0 - UNRELEASED HDFS-5986. Capture the number of blocks pending deletion on namenode webUI. (cnauroth) + HDFS-6070. Cleanup use of ReadStatistics in DFSInputStream. (wang) + OPTIMIZATIONS HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java index 9663712a1e3..5dbef718f30 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java @@ -659,14 +659,11 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, int nRead, BlockReader blockReader) { if (nRead <= 0) return; if (blockReader.isShortCircuit()) { - readStatistics.totalBytesRead += nRead; - readStatistics.totalLocalBytesRead += nRead; - readStatistics.totalShortCircuitBytesRead += nRead; + readStatistics.addShortCircuitBytes(nRead); } else if (blockReader.isLocal()) { - readStatistics.totalBytesRead += nRead; - readStatistics.totalLocalBytesRead += nRead; + readStatistics.addLocalBytes(nRead); } else { - readStatistics.totalBytesRead += nRead; + readStatistics.addRemoteBytes(nRead); } }