From 57f91f9541b5b2f73bc644807601d592466d6c3b Mon Sep 17 00:00:00 2001 From: Thomas Graves Date: Tue, 26 Mar 2013 18:00:30 +0000 Subject: [PATCH] MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can become slow in some cases (ravigummadi via tgraves). git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1461243 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../hadoop/mapred/gridmix/GenerateDistCacheData.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index cfe813044ed..03d27983a73 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -87,6 +87,9 @@ Release 2.0.5-beta - UNRELEASED job if the trace contains null taskStatus for a task. (ravigummadi via tgraves) + MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can + become slow in some cases (ravigummadi via tgraves). + Release 2.0.4-alpha - UNRELEASED diff --git a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java index c90e17c6bf4..fad34ab7df2 100644 --- a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java +++ b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java @@ -156,10 +156,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(); }