Program: 82473
Project: 82473
Buggy source:
@Test public void testBlurOutputFormatOverFlowMultipleReducersWithReduceMultiplierTest() throws IOException, InterruptedException, ClassNotFoundException {
  localFs.delete(new Path(TEST_ROOT_DIR + "String_Node_Str"),true);
  localFs.delete(new Path(TEST_ROOT_DIR + "String_Node_Str"),true);
  writeRecordsFile("String_Node_Str",1,50,1,1500,"String_Node_Str");
  writeRecordsFile("String_Node_Str",1,50,2000,100,"String_Node_Str");
  Job job=new Job(jobConf,"String_Node_Str");
  job.setJarByClass(BlurOutputFormatTest.class);
  job.setMapperClass(CsvBlurMapper.class);
  job.setInputFormatClass(TrackingTextInputFormat.class);
  FileInputFormat.addInputPath(job,new Path(TEST_ROOT_DIR + "String_Node_Str"));
  String tableUri=new Path(TEST_ROOT_DIR + "String_Node_Str").toString();
  CsvBlurMapper.addColumns(job,"String_Node_Str","String_Node_Str");
  TableDescriptor tableDescriptor=new TableDescriptor();
  tableDescriptor.setShardCount(2);
  tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
  tableDescriptor.setTableUri(tableUri);
  BlurOutputFormat.setupJob(job,tableDescriptor);
  int multiple=2;
  BlurOutputFormat.setReducerMultiplier(job,multiple);
  assertTrue(job.waitForCompletion(true));
  Counters ctrs=job.getCounters();
  System.out.println("String_Node_Str" + ctrs);
  long total=0;
  for (int i=0; i < tableDescriptor.getShardCount(); i++) {
    Path path=new Path(tableUri,BlurUtil.getShardName(i));
    Collection<Path> commitedTasks=getCommitedTasks(path);
    assertEquals(multiple,commitedTasks.size());
    for (    Path p : commitedTasks) {
      DirectoryReader reader=DirectoryReader.open(new HdfsDirectory(conf,p));
      total+=reader.numDocs();
      reader.close();
    }
  }
  assertEquals(80000,total);
}

Fixed version (ground truth):
@Test public void testBlurOutputFormatOverFlowMultipleReducersWithReduceMultiplierTest() throws IOException, InterruptedException, ClassNotFoundException {
  localFs.delete(new Path(TEST_ROOT_DIR + "String_Node_Str"),true);
  localFs.delete(new Path(TEST_ROOT_DIR + "String_Node_Str"),true);
  writeRecordsFile("String_Node_Str",1,50,1,1500,"String_Node_Str");
  writeRecordsFile("String_Node_Str",1,50,2000,100,"String_Node_Str");
  Job job=new Job(jobConf,"String_Node_Str");
  job.setJarByClass(BlurOutputFormatTest.class);
  job.setMapperClass(CsvBlurMapper.class);
  job.setInputFormatClass(TrackingTextInputFormat.class);
  FileInputFormat.addInputPath(job,new Path(TEST_ROOT_DIR + "String_Node_Str"));
  String tableUri=new Path(TEST_ROOT_DIR + "String_Node_Str").toString();
  CsvBlurMapper.addColumns(job,"String_Node_Str","String_Node_Str");
  TableDescriptor tableDescriptor=new TableDescriptor();
  tableDescriptor.setShardCount(7);
  tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
  tableDescriptor.setTableUri(tableUri);
  BlurOutputFormat.setupJob(job,tableDescriptor);
  int multiple=2;
  BlurOutputFormat.setReducerMultiplier(job,multiple);
  assertTrue(job.waitForCompletion(true));
  Counters ctrs=job.getCounters();
  System.out.println("String_Node_Str" + ctrs);
  long total=0;
  for (int i=0; i < tableDescriptor.getShardCount(); i++) {
    Path path=new Path(tableUri,BlurUtil.getShardName(i));
    Collection<Path> commitedTasks=getCommitedTasks(path);
    assertTrue(multiple >= commitedTasks.size());
    for (    Path p : commitedTasks) {
      DirectoryReader reader=DirectoryReader.open(new HdfsDirectory(conf,p));
      total+=reader.numDocs();
      reader.close();
    }
  }
  assertEquals(80000,total);
}