Program: 8818
Project: 8818
Buggy source:
/** 
 * Sweep phase of gc candidate deletion. <p> Performs the following steps depending upon the type of the blob store refer  {@link org.apache.jackrabbit.oak.plugins.blob.SharedDataStore.Type}: <ul> <li>Shared</li> <ul> <li> Merge all marked references (from the mark phase run independently) available in the data store meta store (from all configured independent repositories). <li> Retrieve all blob ids available. <li> Diffs the 2 sets above to retrieve list of blob ids not used. <li> Deletes only blobs created after (earliest time stamp of the marked references - #maxLastModifiedInterval) from the above set. </ul> <li>Default</li> <ul> <li> Mark phase already run. <li> Retrieve all blob ids available. <li> Diffs the 2 sets above to retrieve list of blob ids not used. <li> Deletes only blobs created after (time stamp of the marked references - #maxLastModifiedInterval). </ul> </ul>
 * @return the number of blobs deleted
 * @throws Exception the exception
 */
private int sweep() throws Exception {
  long earliestRefAvailTime;
  try {
    earliestRefAvailTime=GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore,fs);
    LOG.debug("String_Node_Str",earliestRefAvailTime);
  }
 catch (  Exception e) {
    return 0;
  }
  (new BlobIdRetriever()).call();
  difference();
  int count=0;
  state=State.SWEEPING;
  LOG.debug("String_Node_Str");
  LOG.debug("String_Node_Str" + timestampToString(getLastMaxModifiedTime(earliestRefAvailTime)));
  ConcurrentLinkedQueue<String> exceptionQueue=new ConcurrentLinkedQueue<String>();
  LineIterator iterator=FileUtils.lineIterator(fs.getGcCandidates(),Charsets.UTF_8.name());
  List<String> ids=Lists.newArrayList();
  while (iterator.hasNext()) {
    ids.add(iterator.next());
    if (ids.size() > getBatchCount()) {
      count+=ids.size();
      executor.execute(new Sweeper(ids,exceptionQueue,earliestRefAvailTime));
      ids=Lists.newArrayList();
    }
  }
  if (!ids.isEmpty()) {
    count+=ids.size();
    executor.execute(new Sweeper(ids,exceptionQueue,earliestRefAvailTime));
  }
  count-=exceptionQueue.size();
  BufferedWriter writer=null;
  try {
    if (!exceptionQueue.isEmpty()) {
      writer=Files.newWriter(fs.getGarbage(),Charsets.UTF_8);
      saveBatchToFile(Lists.newArrayList(exceptionQueue),writer);
    }
  }
  finally {
    LineIterator.closeQuietly(iterator);
    IOUtils.closeQuietly(writer);
  }
  if (!exceptionQueue.isEmpty()) {
    LOG.warn("String_Node_Str" + "String_Node_Str",timestampToString(getLastMaxModifiedTime(earliestRefAvailTime)),fs.getGarbage().getAbsolutePath());
  }
  GarbageCollectionType.get(blobStore).removeAllMarkedReferences(blobStore);
  LOG.debug("String_Node_Str");
  return count;
}

Fixed version (ground truth):
/** 
 * Sweep phase of gc candidate deletion. <p> Performs the following steps depending upon the type of the blob store refer  {@link org.apache.jackrabbit.oak.plugins.blob.SharedDataStore.Type}: <ul> <li>Shared</li> <ul> <li> Merge all marked references (from the mark phase run independently) available in the data store meta store (from all configured independent repositories). <li> Retrieve all blob ids available. <li> Diffs the 2 sets above to retrieve list of blob ids not used. <li> Deletes only blobs created after (earliest time stamp of the marked references - #maxLastModifiedInterval) from the above set. </ul> <li>Default</li> <ul> <li> Mark phase already run. <li> Retrieve all blob ids available. <li> Diffs the 2 sets above to retrieve list of blob ids not used. <li> Deletes only blobs created after (time stamp of the marked references - #maxLastModifiedInterval). </ul> </ul>
 * @return the number of blobs deleted
 * @throws Exception the exception
 */
private int sweep() throws Exception {
  long earliestRefAvailTime;
  try {
    earliestRefAvailTime=GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore,fs);
    LOG.debug("String_Node_Str",earliestRefAvailTime);
  }
 catch (  Exception e) {
    return 0;
  }
  (new BlobIdRetriever()).call();
  difference();
  int count=0;
  state=State.SWEEPING;
  LOG.debug("String_Node_Str");
  LOG.debug("String_Node_Str",timestampToString(getLastMaxModifiedTime(earliestRefAvailTime)));
  ConcurrentLinkedQueue<String> exceptionQueue=new ConcurrentLinkedQueue<String>();
  LineIterator iterator=FileUtils.lineIterator(fs.getGcCandidates(),Charsets.UTF_8.name());
  List<String> ids=Lists.newArrayList();
  while (iterator.hasNext()) {
    ids.add(iterator.next());
    if (ids.size() > getBatchCount()) {
      count+=ids.size();
      executor.execute(new Sweeper(ids,exceptionQueue,earliestRefAvailTime));
      ids=Lists.newArrayList();
    }
  }
  if (!ids.isEmpty()) {
    count+=ids.size();
    executor.execute(new Sweeper(ids,exceptionQueue,earliestRefAvailTime));
  }
  count-=exceptionQueue.size();
  BufferedWriter writer=null;
  try {
    if (!exceptionQueue.isEmpty()) {
      writer=Files.newWriter(fs.getGarbage(),Charsets.UTF_8);
      saveBatchToFile(Lists.newArrayList(exceptionQueue),writer);
    }
  }
  finally {
    LineIterator.closeQuietly(iterator);
    IOUtils.closeQuietly(writer);
  }
  if (!exceptionQueue.isEmpty()) {
    LOG.warn("String_Node_Str" + "String_Node_Str",timestampToString(getLastMaxModifiedTime(earliestRefAvailTime)),fs.getGarbage().getAbsolutePath());
  }
  GarbageCollectionType.get(blobStore).removeAllMarkedReferences(blobStore);
  LOG.debug("String_Node_Str");
  return count;
}