public int numCompletedBatches() {
        return completed.size();
    }
Get the number of completed batches which are ready to be drained.
This does not include the batch that is currently being filled.
raft/src/main/java/org/apache/kafka/raft/internals/BatchAccumulator.java