Program: 162813
Project: 162813
Buggy source:
public int recoverTier(int segmentIndex){
  s.freeList.clearAll();
  Logger log=lh.LOG;
  VanillaChronicleHash<?,?,?,?> h=mh.h();
  CompactOffHeapLinearHashTable hl=h.hashLookup;
  long hlAddr=s.tierBaseAddr;
  long hlPos=0;
  do {
    long hlEntry=hl.readEntry(hlAddr,hlPos);
    nextHlPos:     if (!hl.empty(hlEntry)) {
      hl.clearEntry(hlAddr,hlPos);
      long searchKey=hl.key(hlEntry);
      long entryPos=hl.value(hlEntry);
      int si=checkEntry(searchKey,entryPos,segmentIndex);
      if (si < 0) {
        break nextHlPos;
      }
 else {
        segmentIndex=si;
      }
      long startInsertPos=hl.hlPos(searchKey);
      long insertPos=startInsertPos;
      do {
        long hlInsertEntry=hl.readEntry(hlAddr,insertPos);
        if (hl.empty(hlInsertEntry)) {
          hl.writeEntry(hlAddr,insertPos,hl.entry(searchKey,entryPos));
          break nextHlPos;
        }
        if (insertPos == hlPos) {
          throw new ChronicleHashRecoveryFailedException("String_Node_Str" + h.file() + "String_Node_Str");
        }
        if (hl.key(hlInsertEntry) == searchKey) {
          long anotherEntryPos=hl.value(hlInsertEntry);
          if (anotherEntryPos == entryPos)           break nextHlPos;
          long currentKeyOffset=e.keyOffset;
          long currentKeySize=e.keySize;
          int currentEntrySizeInChunks=e.entrySizeInChunks;
          if (checkEntry(searchKey,anotherEntryPos,segmentIndex) > 0) {
            if (e.keySize == currentKeySize && BytesUtil.bytesEqual(s.segmentBS,currentKeyOffset,s.segmentBS,e.keyOffset,currentKeySize)) {
              log.error("String_Node_Str" + "String_Node_Str",entryPos,anotherEntryPos,e.key(),e.value());
              s.freeList.clearRange(entryPos,entryPos + currentEntrySizeInChunks);
              break nextHlPos;
            }
          }
        }
        insertPos=hl.step(insertPos);
      }
 while (insertPos != startInsertPos);
      throw new ChronicleHashRecoveryFailedException("String_Node_Str" + "String_Node_Str" + h.file() + "String_Node_Str");
    }
    hlPos=hl.step(hlPos);
  }
 while (hlPos != 0);
  return segmentIndex;
}

Fixed version (ground truth):
public int recoverTier(int segmentIndex){
  s.freeList.clearAll();
  Logger log=lh.LOG;
  VanillaChronicleHash<?,?,?,?> h=mh.h();
  CompactOffHeapLinearHashTable hl=h.hashLookup;
  long hlAddr=s.tierBaseAddr;
  long validEntries=0;
  long hlPos=0;
  do {
    long hlEntry=hl.readEntry(hlAddr,hlPos);
    nextHlPos:     if (!hl.empty(hlEntry)) {
      hl.clearEntry(hlAddr,hlPos);
      if (validEntries >= h.maxEntriesPerHashLookup) {
        log.error("String_Node_Str",s.tierIndex,h.maxEntriesPerHashLookup);
        break nextHlPos;
      }
      long searchKey=hl.key(hlEntry);
      long entryPos=hl.value(hlEntry);
      int si=checkEntry(searchKey,entryPos,segmentIndex);
      if (si < 0) {
        break nextHlPos;
      }
 else {
        s.freeList.setRange(entryPos,entryPos + e.entrySizeInChunks);
        segmentIndex=si;
      }
      long startInsertPos=hl.hlPos(searchKey);
      long insertPos=startInsertPos;
      do {
        long hlInsertEntry=hl.readEntry(hlAddr,insertPos);
        if (hl.empty(hlInsertEntry)) {
          hl.writeEntry(hlAddr,insertPos,hl.entry(searchKey,entryPos));
          validEntries++;
          break nextHlPos;
        }
        if (insertPos == hlPos) {
          throw new ChronicleHashRecoveryFailedException("String_Node_Str" + h.file() + "String_Node_Str");
        }
        checkDuplicateKeys:         if (hl.key(hlInsertEntry) == searchKey) {
          long anotherEntryPos=hl.value(hlInsertEntry);
          if (anotherEntryPos == entryPos) {
            validEntries++;
            break nextHlPos;
          }
          long currentKeyOffset=e.keyOffset;
          long currentKeySize=e.keySize;
          int currentEntrySizeInChunks=e.entrySizeInChunks;
          if (insertPos >= 0 && insertPos < hlPos) {
            e.readExistingEntry(anotherEntryPos);
          }
 else           if (checkEntry(searchKey,anotherEntryPos,segmentIndex) < 0) {
            break checkDuplicateKeys;
          }
          if (e.keySize == currentKeySize && BytesUtil.bytesEqual(s.segmentBS,currentKeyOffset,s.segmentBS,e.keyOffset,currentKeySize)) {
            log.error("String_Node_Str" + "String_Node_Str",entryPos,anotherEntryPos,e.key(),e.value());
            s.freeList.clearRange(entryPos,entryPos + currentEntrySizeInChunks);
            break nextHlPos;
          }
        }
        insertPos=hl.step(insertPos);
      }
 while (insertPos != startInsertPos);
      throw new ChronicleHashRecoveryFailedException("String_Node_Str" + "String_Node_Str" + h.file() + "String_Node_Str");
    }
    hlPos=hl.step(hlPos);
  }
 while (hlPos != 0);
  shiftHashLookupEntries();
  return segmentIndex;
}