Kaynağa Gözat

commit c6e8d39fbe89447416c1cc9943b22d3c99e058df
Author: Siddharth Seth <sseth@yahoo-inc.com>
Date: Thu Jan 27 17:55:33 2011 -0800

included a cuople more methods in NewTrackingRecordReader
for computing the counters.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077779 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 yıl önce
ebeveyn
işleme
05b28854d6

+ 8 - 1
src/mapred/org/apache/hadoop/mapred/MapTask.java

@@ -469,7 +469,6 @@ class MapTask extends Task {
         TaskReporter reporter, JobConf job,
         org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
         throws IOException, InterruptedException {
-      this.real = inputFormat.createRecordReader(split, taskContext);
       this.reporter = reporter;
       this.inputSplit = split;
       this.job = job;
@@ -483,11 +482,19 @@ class MapTask extends Task {
             .getPath());
       } 
       fsStats = matchedStats;
+	  
+      long bytesInPrev = getInputBytes(fsStats);
+      this.real = inputFormat.createRecordReader(split, taskContext);
+      long bytesInCurr = getInputBytes(fsStats);
+      fileInputByteCounter.increment(bytesInCurr - bytesInPrev);
     }
 
     @Override
     public void close() throws IOException {
+      long bytesInPrev = getInputBytes(fsStats);
       real.close();
+      long bytesInCurr = getInputBytes(fsStats);
+      fileInputByteCounter.increment(bytesInCurr - bytesInPrev);
     }
 
     @Override