Program: 163013
Project: 163013
Buggy source:
<KB,KBI,MKBI extends MetaBytesInterop<KB,? super KBI>,RV,VB extends RV,VBI,MVBI extends MetaBytesInterop<RV,? super VBI>>Object replace(@Nullable ThreadLocalCopies copies,@Nullable SegmentState segmentState,MKBI metaKeyInterop,KBI keyInterop,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,GetValueInterops<VB,VBI,MVBI> getExpectedValueInterops,VB expectedValue,GetValueInterops<VB,VBI,MVBI> getNewValueInterops,VB newValue,ReadValue<RV> readValue,InstanceOrBytesToInstance<? super RV,V> toValue,long hash2){
  segmentStateNotNullImpliesCopiesNotNull(copies,segmentState);
  long timestamp=currentTime();
  byte identifier=localIdentifier;
  writeLock(null);
  try {
    MultiMap hashLookup=hashLookup();
    hashLookup.startSearch(hash2);
    MultiStoreBytes entry=null;
    for (long pos; (pos=hashLookup.nextPos()) >= 0L; ) {
      long offset=offsetFromPos(pos);
      if (entry == null) {
        if (segmentState == null) {
          copies=SegmentState.getCopies(copies);
          segmentState=SegmentState.get(copies);
        }
        entry=segmentState.tmpBytes;
      }
      reuse(entry,offset);
      if (!keyEquals(keyInterop,metaKeyInterop,key,keySize,entry))       continue;
      entry.skip(keySize);
      long timestampPos=entry.position();
      if (shouldIgnore(entry,timestamp,identifier))       return null;
      boolean isDeleted=entry.readBoolean();
      if (isDeleted)       break;
      Object result=onKeyPresentOnReplace(copies,segmentState,key,keySize,toKey,getExpectedValueInterops,expectedValue,getNewValueInterops,newValue,readValue,toValue,pos,offset,entry,hashLookup);
      if (result != Boolean.FALSE) {
        entry.position(timestampPos);
        entry.writeLong(timestamp);
        entry.writeByte(identifier);
      }
      return result;
    }
    return null;
  }
  finally {
    if (segmentState != null)     segmentState.close();
    writeUnlock();
  }
}

Fixed version (ground truth):
<KB,KBI,MKBI extends MetaBytesInterop<KB,? super KBI>,RV,VB extends RV,VBI,MVBI extends MetaBytesInterop<RV,? super VBI>>Object replace(@Nullable ThreadLocalCopies copies,@Nullable SegmentState segmentState,MKBI metaKeyInterop,KBI keyInterop,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,GetValueInterops<VB,VBI,MVBI> getExpectedValueInterops,VB expectedValue,GetValueInterops<VB,VBI,MVBI> getNewValueInterops,VB newValue,ReadValue<RV> readValue,InstanceOrBytesToInstance<? super RV,V> toValue,long hash2){
  segmentStateNotNullImpliesCopiesNotNull(copies,segmentState);
  long timestamp=currentTime();
  byte identifier=localIdentifier;
  writeLock(null);
  try {
    MultiMap hashLookup=hashLookup();
    hashLookup.startSearch(hash2);
    MultiStoreBytes entry=null;
    for (long pos; (pos=hashLookup.nextPos()) >= 0L; ) {
      long offset=offsetFromPos(pos);
      if (entry == null) {
        if (segmentState == null) {
          copies=SegmentState.getCopies(copies);
          segmentState=SegmentState.get(copies);
        }
        entry=segmentState.tmpBytes;
      }
      reuse(entry,offset);
      if (!keyEquals(keyInterop,metaKeyInterop,key,keySize,entry))       continue;
      entry.skip(keySize);
      long timestampPos=entry.position();
      if (shouldIgnore(entry,timestamp,identifier)) {
        LOG.error("String_Node_Str" + "String_Node_Str" + "String_Node_Str",key,identifier,timestamp,entry.readByte(entry.position() - 1),entry.readLong(entry.position() - ADDITIONAL_ENTRY_BYTES + 1));
        return readValue.readNull();
      }
      boolean isDeleted=entry.readBoolean();
      if (isDeleted)       break;
      Object result=onKeyPresentOnReplace(copies,segmentState,key,keySize,toKey,getExpectedValueInterops,expectedValue,getNewValueInterops,newValue,readValue,toValue,pos,offset,entry,hashLookup);
      if (result != Boolean.FALSE) {
        entry.position(timestampPos);
        entry.writeLong(timestamp);
        entry.writeByte(identifier);
      }
      return result;
    }
    return readValue.readNull();
  }
  finally {
    if (segmentState != null)     segmentState.close();
    writeUnlock();
  }
}