Skip to content

Commit e011b51

Browse files
committed
Fixed bug with update stream generation crashing when numThreads > 1
1 parent 0fb7be9 commit e011b51

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/ldbc/socialnet/dbgen/generator/MRGenerateUsers.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,18 @@ protected void setup(Context context){
9898
FileSystem fs = FileSystem.get(conf);
9999
String strTaskId = context.getTaskAttemptID().getTaskID().toString();
100100
int attempTaskId = Integer.parseInt(strTaskId.substring(strTaskId.length() - 3));
101+
int reducerId = conf.getInt("reducerId",0);
101102
int partitionId = conf.getInt("partitionId",0);
102103
String streamType = conf.get("streamType");
103104
if( Boolean.parseBoolean(conf.get("compressed")) == true ) {
104-
Path outFile = new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".csv.gz");
105+
Path outFile = new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+reducerId+"_"+partitionId+"_"+streamType+".csv.gz");
105106
out = new GZIPOutputStream( fs.create(outFile));
106107
} else {
107-
Path outFile = new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".csv");
108+
Path outFile = new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+reducerId+"_"+partitionId+"_"+streamType+".csv");
108109
out = fs.create(outFile);
109110
}
110111
if (conf.getBoolean("updateStreams",false)) {
111-
properties = fs.create(new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".properties"));
112+
properties = fs.create(new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+reducerId+"_"+partitionId+"_"+streamType+".properties"));
112113
}
113114
} catch (IOException e) {
114115
e.printStackTrace();
@@ -552,6 +553,7 @@ public int runGenerateJob(Configuration conf) throws Exception {
552553
for( int j = 0; j < numPartitions; ++j ) {
553554
/// --------------- Fifth job: Sort update streams ----------------
554555
conf.setInt("mapred.line.input.format.linespermap", 1000000);
556+
conf.setInt("reducerId",i);
555557
conf.setInt("partitionId",j);
556558
conf.set("streamType","forum");
557559
Job jobForum = new Job(conf, "Soring update streams "+j+" of reducer "+i);
@@ -574,6 +576,7 @@ public int runGenerateJob(Configuration conf) throws Exception {
574576
fs.delete(new Path(hadoopDir + "/sibEnd"), true);
575577

576578
conf.setInt("mapred.line.input.format.linespermap", 1000000);
579+
conf.setInt("reducerId",i);
577580
conf.setInt("partitionId",j);
578581
conf.set("streamType","person");
579582
Job jobPerson = new Job(conf, "Soring update streams "+j+" of reducer "+i);

0 commit comments

Comments
 (0)