cmccabe commented on code in PR #13407:
URL: https://github.com/apache/kafka/pull/13407#discussion_r1171950562


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -869,19 +906,30 @@ public CompletableFuture<?> 
acceptBatch(List<ApiMessageAndVersion> recordBatch)
                 return future;
             }
             ControllerWriteEvent<Void> batchEvent = new 
ControllerWriteEvent<>("ZK Migration Batch",
-                new MigrationWriteOperation(recordBatch));
+                new MigrationWriteOperation(recordBatch), 
EnumSet.of(RUNS_IN_PREMIGRATION));
             queue.append(batchEvent);
             return batchEvent.future;
         }
 
         @Override
-        public OffsetAndEpoch completeMigration() {
-            // TODO write migration record, use KIP-868 transaction
-            return highestMigrationRecordOffset;
+        public CompletableFuture<OffsetAndEpoch> completeMigration() {
+            log.info("Completing ZK Migration");
+            // TODO use KIP-868 transaction
+            ControllerWriteEvent<Void> event = new 
ControllerWriteEvent<>("Complete ZK Migration",
+                new MigrationWriteOperation(
+                    Collections.singletonList(
+                        new ApiMessageAndVersion(
+                            new 
ZkMigrationStateRecord().setZkMigrationState(ZkMigrationState.MIGRATION.value()),
+                            ZkMigrationStateRecord.LOWEST_SUPPORTED_VERSION)
+                    )),
+                EnumSet.of(RUNS_IN_PREMIGRATION));
+            queue.append(event);
+            return event.future.thenApply(__ -> highestMigrationRecordOffset);
         }
 
         @Override
         public void abortMigration() {
+            log.error("Aborting ZK Migration");

Review Comment:
   Fair enough. I think we should probably call the faultHandler, at least. Or 
throw an unhandled exception to fail over?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to