Program: 61073
Project: 61073
Buggy source:
/** 
 * Swaps the versioned list at the tail of the pipeline with the new compacted segment. Swapping only if there were no changes to the suffix of the list while it was compacted.
 * @param versionedList tail of the pipeline that was compacted
 * @param segment new compacted segment
 * @param closeSuffix whether to close the suffix (to release memory), as part of swapping it outDuring index merge op this will be false and for compaction it will be true.
 * @return true iff swapped tail with new compacted segment
 */
public boolean swap(VersionedSegmentsList versionedList,ImmutableSegment segment,boolean closeSuffix){
  if (versionedList.getVersion() != version) {
    return false;
  }
  List<ImmutableSegment> suffix;
synchronized (pipeline) {
    if (versionedList.getVersion() != version) {
      return false;
    }
    suffix=versionedList.getStoreSegments();
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str" + versionedList.getStoreSegments().size() + "String_Node_Str"+ segment.getCellsCount());
    }
    swapSuffix(suffix,segment,closeSuffix);
  }
  if (region != null) {
    long suffixDataSize=getSegmentsKeySize(suffix);
    long newDataSize=segment.keySize();
    long dataSizeDelta=suffixDataSize - newDataSize;
    long suffixHeapOverhead=getSegmentsHeapOverhead(suffix);
    long newHeapOverhead=segment.heapOverhead();
    long heapOverheadDelta=suffixHeapOverhead - newHeapOverhead;
    region.addMemstoreSize(new MemstoreSize(-dataSizeDelta,-heapOverheadDelta));
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + suffixDataSize + "String_Node_Str"+ newDataSize+ "String_Node_Str"+ suffixHeapOverhead+ "String_Node_Str"+ newHeapOverhead);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Swaps the versioned list at the tail of the pipeline with a new segment. Swapping only if there were no changes to the suffix of the list since the version list was created.
 * @param versionedList suffix of the pipeline to be replaced can be tail or all the pipeline
 * @param segment new segment to replace the suffix. Can be null if the suffix just needs to beremoved.
 * @param closeSuffix whether to close the suffix (to release memory), as part of swapping it outDuring index merge op this will be false and for compaction it will be true.
 * @return true iff swapped tail with new segment
 */
public boolean swap(VersionedSegmentsList versionedList,ImmutableSegment segment,boolean closeSuffix){
  if (versionedList.getVersion() != version) {
    return false;
  }
  List<ImmutableSegment> suffix;
synchronized (pipeline) {
    if (versionedList.getVersion() != version) {
      return false;
    }
    suffix=versionedList.getStoreSegments();
    if (LOG.isDebugEnabled()) {
      int count=0;
      if (segment != null) {
        count=segment.getCellsCount();
      }
      LOG.debug("String_Node_Str" + "String_Node_Str" + versionedList.getStoreSegments().size() + "String_Node_Str"+ count);
    }
    swapSuffix(suffix,segment,closeSuffix);
  }
  if (closeSuffix && region != null) {
    long suffixDataSize=getSegmentsKeySize(suffix);
    long newDataSize=0;
    if (segment != null)     newDataSize=segment.keySize();
    long dataSizeDelta=suffixDataSize - newDataSize;
    long suffixHeapOverhead=getSegmentsHeapOverhead(suffix);
    long newHeapOverhead=0;
    if (segment != null)     newHeapOverhead=segment.heapOverhead();
    long heapOverheadDelta=suffixHeapOverhead - newHeapOverhead;
    region.addMemstoreSize(new MemstoreSize(-dataSizeDelta,-heapOverheadDelta));
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + suffixDataSize + "String_Node_Str"+ newDataSize+ "String_Node_Str"+ suffixHeapOverhead+ "String_Node_Str"+ newHeapOverhead);
    }
  }
  return true;
}