public long lastOffset() {
        return nextOffset - 1;
    }
Return the offset of the last appended record. This is updated after
every append and can be used after the batch has been built to obtain
the last offset.

@return the offset of the last appended record
raft/src/main/java/org/apache/kafka/raft/internals/BatchBuilder.java