Selaa lähdekoodia

MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can become slow in some cases (ravigummadi)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1307739 13f79535-47bb-0310-9956-ffa450edef68
Ravi Gummadi 13 vuotta sitten
vanhempi
commit
0e23b0f61d

+ 3 - 0
CHANGES.txt

@@ -81,6 +81,9 @@ Release 1.1.0 - unreleased
 
   BUG FIXES
 
+    MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can
+                    become slow in some cases (ravigummadi)
+
     HDFS-2305. Running multiple 2NNs can result in corrupt file system. (atm)
 
     HADOOP-7634. Docs specify wrong owner for task-controller.cfg (eli)

+ 4 - 3
src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java

@@ -155,10 +155,11 @@ class GenerateDistCacheData extends GridmixJob {
       FSDataOutputStream dos =
           FileSystem.create(fs, path, new FsPermission((short)0755));
 
-      for (long bytes = key.get(); bytes > 0; bytes -= val.getLength()) {
+      int size = 0;
+      for (long bytes = key.get(); bytes > 0; bytes -= size) {
         r.nextBytes(val.getBytes());
-        val.setSize((int)Math.min(val.getLength(), bytes));
-        dos.write(val.getBytes(), 0, val.getLength());// Write to distCache file
+        size = (int)Math.min(val.getLength(), bytes);
+        dos.write(val.getBytes(), 0, size);// Write to distCache file
       }
       dos.close();
     }