private boolean isJournalEmptyAfterAutoClose() {
    logger.trace("DataDir: {} journal size is : {}", dataDir, journal.getCurrentNumberOfEntries());
    logger.trace("DataDir: {} last log segment start offset: {}, end offset: {}", dataDir,
        log.getLastSegment().getStartOffset(), log.getLastSegment().getEndOffset());
    return journal.getCurrentNumberOfEntries() == 0 && log.getLastSegment().isEmpty() && !log.getLastSegment()
        .getName()
        .equals(log.getFirstSegment().getName());
  }
The method checks three conditions: 1. journal is empty, 2. log segment is empty, 3. it's not the first log segment.
@return {@link true} if last log segment only contains the header info after auto closing last log segment during compaction.
ambry-store/src/main/java/com/github/ambry/store/PersistentIndex.java