Skip to content

Commit 73a386a

Browse files
HADOOP-16585. [Tool:NNloadGeneratorMR] Multiple threads are using same id for creating file LoadGenerator#write. Contributed by Ranith Sardar.
1 parent 586defe commit 73a386a

File tree

1 file changed

+3
-1
lines changed
  • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator

1 file changed

+3
-1
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Arrays;
3232
import java.util.EnumSet;
3333
import java.util.Random;
34+
import java.util.UUID;
3435

3536
import org.apache.hadoop.conf.Configuration;
3637
import org.apache.hadoop.conf.Configured;
@@ -295,7 +296,8 @@ private void read() throws IOException {
295296
*/
296297
private void write() throws IOException {
297298
String dirName = dirs.get(r.nextInt(dirs.size()));
298-
Path file = new Path(dirName, hostname+id);
299+
Path file =
300+
new Path(dirName, hostname + id + UUID.randomUUID().toString());
299301
double fileSize = 0;
300302
while ((fileSize = r.nextGaussian()+2)<=0) {}
301303
genFile(file, (long)(fileSize*BLOCK_SIZE));

0 commit comments

Comments
 (0)