Program: 162948
Project: 162948
Buggy source:
@Override <KB,KBI,MKBI extends MetaBytesInterop<KB,? super KBI>,RV>RV acquireWithoutLock(@NotNull ThreadLocalCopies copies,@NotNull SegmentState segmentState,MKBI metaKeyInterop,KBI keyInterop,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,ReadValue<RV> readValue,RV usingValue,InstanceOrBytesToInstance<RV,V> toValue,long hash2,boolean create,MutableLockedEntry lock){
  MultiStoreBytes entry=segmentState.tmpBytes;
  MultiMap hashLookup=hashLookup();
  SearchState searchState=segmentState.searchState;
  hashLookup.startSearch(hash2,searchState);
  for (long pos; (pos=hashLookup.nextPos(searchState)) >= 0L; ) {
    long offset=offsetFromPos(pos);
    reuse(entry,offset);
    if (!keyEquals(keyInterop,metaKeyInterop,key,keySize,entry))     continue;
    entry.skip(keySize);
    entry.skip(ADDITIONAL_ENTRY_BYTES - 1L);
    boolean isDeleted=entry.readBoolean();
    if (isDeleted) {
      if (!create)       return readValue.readNull();
      long valueSizePos=entry.position();
      entry.position(valueSizePos - ADDITIONAL_ENTRY_BYTES);
      entry.writeLong(currentTime());
      entry.writeByte(localIdentifier);
      entry.writeBoolean(false);
      long prevValueSize=valueSizeMarshaller.readSize(entry);
      long sizeOfEverythingBeforeValue=entry.position();
      alignment.alignPositionAddr(entry);
      long valueAddr=entry.positionAddr();
      long entryEndAddr=valueAddr + prevValueSize;
      K keyInstance=toKey.toInstance(copies,key,keySize);
      MetaBytesWriter metaElemWriter;
      Object elemWriter;
      Object elem;
      if (defaultValueProvider != null) {
        V defaultValue=defaultValueProvider.get(keyInstance);
        elem=defaultValue;
        VI valueInterop=valueInteropProvider.get(copies,originalValueInterop);
        elemWriter=valueInterop;
        metaElemWriter=metaValueInteropProvider.get(copies,originalMetaValueInterop,valueInterop,defaultValue);
      }
 else       if (prepareValueBytesAsWriter != null) {
        elem=keyInstance;
        elemWriter=null;
        metaElemWriter=prepareValueBytesAsWriter;
      }
 else {
        throw defaultValueOrPrepareBytesShouldBeSpecified();
      }
      putValue(pos,offset,entry,valueSizePos,entryEndAddr,segmentState,metaElemWriter,elemWriter,elem,metaElemWriter.size(elemWriter,elem),hashLookup,sizeOfEverythingBeforeValue);
      pos=segmentState.pos;
      incrementSize();
      hashLookup.putPosition(pos);
      entry.position(valueSizePos);
      long valueSize=readValueSize(entry);
      long valuePos=entry.position();
      RV v=readValue.readValue(copies,entry,usingValue,valueSize);
      onPut(this,pos);
      if (bytesEventListener != null) {
        bytesEventListener.onPut(entry,0L,metaDataBytes,valuePos,true);
      }
      if (eventListener != null) {
        V valueInstance=toValue.toInstance(copies,v,valueSize);
        eventListener.onPut(keyInstance,valueInstance,null);
      }
      return v;
    }
 else {
      segmentState.pos=pos;
      return readValueAndNotifyGet(copies,key,keySize,toKey,readValue,usingValue,toValue,entry);
    }
  }
  if (!create)   return readValue.readNull();
  RV result=createEntryOnAcquire(copies,segmentState,metaKeyInterop,keyInterop,key,keySize,toKey,readValue,usingValue,toValue,entry);
  if (lock instanceof WriteLocked)   ((WriteLocked)lock).created(false);
  return result;
}

Fixed version (ground truth):
@Override <KB,KBI,MKBI extends MetaBytesInterop<KB,? super KBI>,RV>RV acquireWithoutLock(@NotNull ThreadLocalCopies copies,@NotNull SegmentState segmentState,MKBI metaKeyInterop,KBI keyInterop,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,ReadValue<RV> readValue,RV usingValue,InstanceOrBytesToInstance<RV,V> toValue,long hash2,boolean create,MutableLockedEntry lock){
  MultiStoreBytes entry=segmentState.tmpBytes;
  MultiMap hashLookup=hashLookup();
  SearchState searchState=segmentState.searchState;
  hashLookup.startSearch(hash2,searchState);
  for (long pos; (pos=hashLookup.nextPos(searchState)) >= 0L; ) {
    long offset=offsetFromPos(pos);
    reuse(entry,offset);
    if (!keyEquals(keyInterop,metaKeyInterop,key,keySize,entry))     continue;
    entry.skip(keySize);
    entry.skip(ADDITIONAL_ENTRY_BYTES - 1L);
    boolean isDeleted=entry.readBoolean();
    if (isDeleted) {
      if (!create)       return readValue.readNull();
      long valueSizePos=entry.position();
      entry.position(valueSizePos - ADDITIONAL_ENTRY_BYTES);
      entry.writeLong(currentTime());
      entry.writeByte(localIdentifier);
      entry.writeBoolean(false);
      long prevValueSize=valueSizeMarshaller.readSize(entry);
      long sizeOfEverythingBeforeValue=entry.position();
      alignment.alignPositionAddr(entry);
      long valueAddr=entry.positionAddr();
      long entryEndAddr=valueAddr + prevValueSize;
      K keyInstance=toKey.toInstance(copies,key,keySize);
      MetaBytesWriter metaElemWriter;
      Object elemWriter;
      Object elem;
      if (defaultValueProvider != null) {
        V defaultValue=defaultValueProvider.get(keyInstance);
        elem=defaultValue;
        VI valueInterop=valueInteropProvider.get(copies,originalValueInterop);
        elemWriter=valueInterop;
        metaElemWriter=metaValueInteropProvider.get(copies,originalMetaValueInterop,valueInterop,defaultValue);
      }
 else       if (prepareValueBytesAsWriter != null) {
        elem=keyInstance;
        elemWriter=null;
        metaElemWriter=prepareValueBytesAsWriter;
      }
 else {
        throw defaultValueOrPrepareBytesShouldBeSpecified();
      }
      putValue(pos,offset,entry,valueSizePos,entryEndAddr,isDeleted,segmentState,metaElemWriter,elemWriter,elem,metaElemWriter.size(elemWriter,elem),hashLookup,sizeOfEverythingBeforeValue);
      pos=segmentState.pos;
      incrementSize();
      hashLookup.putPosition(pos);
      entry.position(valueSizePos);
      long valueSize=readValueSize(entry);
      long valuePos=entry.position();
      RV v=readValue.readValue(copies,entry,usingValue,valueSize);
      onPut(this,pos);
      if (bytesEventListener != null) {
        bytesEventListener.onPut(entry,0L,metaDataBytes,valuePos,true);
      }
      if (eventListener != null) {
        V valueInstance=toValue.toInstance(copies,v,valueSize);
        eventListener.onPut(keyInstance,valueInstance,null);
      }
      entryCreated(lock);
      return v;
    }
 else {
      segmentState.pos=pos;
      return readValueAndNotifyGet(copies,key,keySize,toKey,readValue,usingValue,toValue,entry);
    }
  }
  if (!create)   return readValue.readNull();
  RV result=createEntryOnAcquire(copies,segmentState,metaKeyInterop,keyInterop,key,keySize,toKey,readValue,usingValue,toValue,entry);
  entryCreated(lock);
  return result;
}