private void removeIndexEntryNotBelongsToLastLogSegmentFromJournal() {
    LogSegmentName lastLogSegmentName = log.getLastSegment().getName();
    Offset journalFirstOffset = journal.getFirstOffset();
    while (journalFirstOffset != null && !journalFirstOffset.getName().equals(lastLogSegmentName)) {
      journal.removeSpecificValueInJournal(journalFirstOffset);
      journalFirstOffset = journal.getFirstOffset();
    }
  }
Remove entry not belongs to last log segment in journal
ambry-store/src/main/java/com/github/ambry/store/PersistentIndex.java