private void checkOffsetIsValid(long offset) {
        long fixedNextOffset = nextOffset;
        if (offset >= fixedNextOffset) {
            throw new IllegalArgumentException(
                String.format(
                    "Attempting the read a value at an offset (%d) which is greater than or " +
                    "equal to the largest known offset (%d)",
                    offset,
                    fixedNextOffset - 1
                )
            );
        }
    }
Returns the finalized kraft version at a given offset.

@param offset the offset (inclusive)
@return the finalized kraft version if one exist, otherwise 0
raft/src/main/java/org/apache/kafka/raft/internals/KRaftControlRecordStateMachine.java