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/trunk@1307740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ravi Gummadi 2012-03-31 08:24:15 +00:00
parent c4c7ee5b8c
commit 170ff8d81c
2 changed files with 7 additions and 3 deletions

View File

@ -52,6 +52,9 @@ Trunk (unreleased changes)
BUG FIXES
MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can
become slow in some cases (ravigummadi).
MAPREDUCE-3953. [Gridmix] Gridmix throws NPE and does not simulate a
job if the trace contains null taskStatus for a task.
(ravigummadi)

View File

@ -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();
}