@Override
    public String toString() {
        // We don't call `largestRecordTimestamp` below to avoid materializing the time index when `toString` is invoked
        return "LogSegment(baseOffset=" + baseOffset +
            ", size=" + size() +
            ", lastModifiedTime=" + lastModified() +
            ", largestRecordTimestamp=" + maxTimestampAndOffsetSoFar.timestamp +
            ")";
    }
Check whether the last offset of the last batch in this segment overflows the indexes.
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java