Program: 91419
Project: 91419
Buggy source:
V put(Bytes keyBytes,K key,V value,int hash2,boolean replaceIfPresent,final byte identifier,final long timestamp){
  lock();
  try {
    long keyLen=keyBytes.remaining();
    hashLookupLiveAndDeleted.startSearch(hash2);
    int pos;
    while ((pos=hashLookupLiveAndDeleted.nextPos()) >= 0) {
      long offset=offsetFromPos(pos);
      NativeBytes entry=entry(offset);
      if (!keyEquals(keyBytes,keyLen,entry))       continue;
      entry.skip(keyLen);
      if (replaceIfPresent) {
        boolean wasDeleted=false;
        if (canReplicate) {
          final long timeStampPos=entry.positionAddr();
          if (shouldTerminate(entry,timestamp,identifier))           return null;
          wasDeleted=entry.readBoolean();
          entry.positionAddr(timeStampPos);
          entry.writeLong(timestamp);
          entry.writeByte(identifier);
          entry.writeBoolean(false);
        }
        final V result=replaceValueOnPut(key,value,entry,pos,offset);
        if (wasDeleted) {
          hashLookupLiveOnly.put(hash2,pos);
          incrementSize();
          return null;
        }
 else {
          return result;
        }
      }
 else {
        if (!canReplicate)         return putReturnsNull ? null : readValue(entry,null);
        if (shouldTerminate(entry,timestamp,identifier))         return null;
        final boolean wasDeleted=entry.readBoolean();
        if (wasDeleted) {
          hashLookupLiveOnly.put(hash2,pos);
          incrementSize();
          return null;
        }
        return putReturnsNull ? null : readValue(entry,null);
      }
    }
    long offset=putEntry(keyBytes,hash2,value,identifier);
    incrementSize();
    notifyPut(offset,true,key,value,posFromOffset(offset));
    return null;
  }
  finally {
    unlock();
  }
}

Fixed version (ground truth):
V put(Bytes keyBytes,K key,V value,int hash2,boolean replaceIfPresent,final byte identifier,final long timestamp){
  lock();
  try {
    long keyLen=keyBytes.remaining();
    hashLookupLiveAndDeleted.startSearch(hash2);
    int pos;
    while ((pos=hashLookupLiveAndDeleted.nextPos()) >= 0) {
      long offset=offsetFromPos(pos);
      NativeBytes entry=entry(offset);
      if (!keyEquals(keyBytes,keyLen,entry))       continue;
      entry.skip(keyLen);
      if (replaceIfPresent) {
        boolean wasDeleted=false;
        if (canReplicate) {
          final long timeStampPos=entry.positionAddr();
          if (shouldTerminate(entry,timestamp,identifier))           return null;
          wasDeleted=entry.readBoolean();
          entry.positionAddr(timeStampPos);
          entry.writeLong(timestamp);
          entry.writeByte(identifier);
          entry.writeBoolean(false);
        }
        final V result=replaceValueOnPut(key,value,entry,pos,offset);
        if (wasDeleted) {
          hashLookupLiveOnly.put(hash2,pos);
          incrementSize();
          return null;
        }
 else {
          return result;
        }
      }
 else {
        if (canReplicate) {
          if (shouldTerminate(entry,timestamp,identifier))           return null;
          final boolean wasDeleted=entry.readBoolean();
          if (wasDeleted) {
            hashLookupLiveOnly.put(hash2,pos);
            incrementSize();
            return null;
          }
        }
        return putReturnsNull ? null : readValue(entry,null);
      }
    }
    long offset=putEntry(keyBytes,hash2,value,identifier);
    incrementSize();
    notifyPut(offset,true,key,value,posFromOffset(offset));
    return null;
  }
  finally {
    unlock();
  }
}