private void maybeLoadLog() {
        while (log.endOffset().offset() > nextOffset) {
            LogFetchInfo info = log.read(nextOffset, Isolation.UNCOMMITTED);
            try (RecordsIterator<?> iterator = new RecordsIterator<>(
                    info.records,
                    serde,
                    bufferSupplier,
                    maxBatchSizeBytes,
                    true // Validate batch CRC
                )
            ) {
                while (iterator.hasNext()) {
                    Batch<?> batch = iterator.next();
                    handleBatch(batch, OptionalLong.empty());
                    nextOffset = batch.lastOffset() + 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