@Override
        public CompletableFuture<OffsetAndEpoch> completeMigration() {
            log.info("Completing migration of ZooKeeper metadata to KRaft.");
            List<ApiMessageAndVersion> records = new ArrayList<>(2);
            records.add(ZkMigrationState.MIGRATION.toRecord());
            if (featureControl.metadataVersion().isMetadataTransactionSupported()) {
                records.add(new ApiMessageAndVersion(new EndTransactionRecord(), (short) 0));
            }
            ControllerWriteEvent<Void> event = new ControllerWriteEvent<>(
                "Complete ZK Migration",
                new MigrationWriteOperation(records),
                eventFlags);
            queue.append(event);
            return event.future.thenApply(__ -> highestMigrationRecordOffset);
        }
Append records to the Raft log. They will be written out asynchronously.

@param log                   The log4j logger.
@param result                The controller result we are writing out.
@param maxRecordsPerBatch    The maximum number of records to allow in a batch.
@param appender              The callback to invoke for each batch. The arguments are last
                             write offset, record list, and the return result is the new
                             last write offset.
@return                      The final offset that was returned from the Raft layer.
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java