private boolean canConvertToRelativeOffset(long offset) throws IOException {
        return offsetIndex().canAppendOffset(offset);
    }
checks that the argument offset can be represented as an integer offset relative to the baseOffset.
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java