Program: 8742
Project: 8742
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
 * @param fs the garbage collector file state
 * @param markStart the start time of mark to take as reference for deletion
 */
protected long sweep(GarbageCollectorFileState fs,long markStart) throws Exception {
  long earliestRefAvailTime;
  try {
    earliestRefAvailTime=GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore,fs);
    LOG.debug("String_Node_Str",earliestRefAvailTime);
    earliestRefAvailTime=(earliestRefAvailTime < markStart ? earliestRefAvailTime : markStart);
  }
 catch (  Exception e) {
    return 0;
  }
  (new BlobIdRetriever(fs)).call();
  difference(fs);
  long count=0;
  long deleted=0;
  long lastMaxModifiedTime=getLastMaxModifiedTime(earliestRefAvailTime);
  LOG.debug("String_Node_Str");
  LOG.debug("String_Node_Str",timestampToString(lastMaxModifiedTime));
  ConcurrentLinkedQueue<String> exceptionQueue=new ConcurrentLinkedQueue<String>();
  LineIterator iterator=FileUtils.lineIterator(fs.getGcCandidates(),Charsets.UTF_8.name());
  List<String> ids=newArrayList();
  while (iterator.hasNext()) {
    ids.add(iterator.next());
    if (ids.size() >= getBatchCount()) {
      count+=ids.size();
      deleted+=sweepInternal(ids,exceptionQueue,lastMaxModifiedTime);
      ids=newArrayList();
    }
  }
  if (!ids.isEmpty()) {
    count+=ids.size();
    deleted+=sweepInternal(ids,exceptionQueue,lastMaxModifiedTime);
  }
  BufferedWriter writer=null;
  try {
    if (!exceptionQueue.isEmpty()) {
      writer=Files.newWriter(fs.getGarbage(),Charsets.UTF_8);
      saveBatchToFile(newArrayList(exceptionQueue),writer);
    }
  }
  finally {
    LineIterator.closeQuietly(iterator);
    IOUtils.closeQuietly(writer);
  }
  if (!exceptionQueue.isEmpty()) {
    LOG.warn("String_Node_Str" + "String_Node_Str",fs.getGarbage().getAbsolutePath());
  }
  if (count != deleted) {
    LOG.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str",deleted,count,timestampToString(lastMaxModifiedTime));
  }
  GarbageCollectionType.get(blobStore).removeAllMarkedReferences(blobStore);
  LOG.debug("String_Node_Str");
  return deleted;
}

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> <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> <li>Default</li> <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> </li> </ul>
 * @return the number of blobs deleted
 * @throws Exception the exception
 * @param fs the garbage collector file state
 * @param markStart the start time of mark to take as reference for deletion
 */
protected long sweep(GarbageCollectorFileState fs,long markStart) throws Exception {
  long earliestRefAvailTime;
  try {
    earliestRefAvailTime=GarbageCollectionType.get(blobStore).mergeAllMarkedReferences(blobStore,fs);
    LOG.debug("String_Node_Str",earliestRefAvailTime);
    earliestRefAvailTime=(earliestRefAvailTime < markStart ? earliestRefAvailTime : markStart);
  }
 catch (  Exception e) {
    return 0;
  }
  (new BlobIdRetriever(fs)).call();
  difference(fs);
  long count=0;
  long deleted=0;
  long lastMaxModifiedTime=getLastMaxModifiedTime(earliestRefAvailTime);
  LOG.debug("String_Node_Str");
  LOG.debug("String_Node_Str",timestampToString(lastMaxModifiedTime));
  ConcurrentLinkedQueue<String> exceptionQueue=new ConcurrentLinkedQueue<String>();
  LineIterator iterator=FileUtils.lineIterator(fs.getGcCandidates(),Charsets.UTF_8.name());
  List<String> ids=newArrayList();
  while (iterator.hasNext()) {
    ids.add(iterator.next());
    if (ids.size() >= getBatchCount()) {
      count+=ids.size();
      deleted+=sweepInternal(ids,exceptionQueue,lastMaxModifiedTime);
      ids=newArrayList();
    }
  }
  if (!ids.isEmpty()) {
    count+=ids.size();
    deleted+=sweepInternal(ids,exceptionQueue,lastMaxModifiedTime);
  }
  BufferedWriter writer=null;
  try {
    if (!exceptionQueue.isEmpty()) {
      writer=Files.newWriter(fs.getGarbage(),Charsets.UTF_8);
      saveBatchToFile(newArrayList(exceptionQueue),writer);
    }
  }
  finally {
    LineIterator.closeQuietly(iterator);
    IOUtils.closeQuietly(writer);
  }
  if (!exceptionQueue.isEmpty()) {
    LOG.warn("String_Node_Str" + "String_Node_Str",fs.getGarbage().getAbsolutePath());
  }
  if (count != deleted) {
    LOG.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str",deleted,count,timestampToString(lastMaxModifiedTime));
  }
  GarbageCollectionType.get(blobStore).removeAllMarkedReferences(blobStore);
  LOG.debug("String_Node_Str");
  return deleted;
}