soarez commented on code in PR #15732:
URL: https://github.com/apache/kafka/pull/15732#discussion_r1572557807


##########
metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java:
##########
@@ -786,12 +773,29 @@ public void run() throws Exception {
         }
     }
 
+    class RecoverMigrationStateFromZKEvent extends MigrationEvent {
+        @Override
+        public void run() throws Exception {
+            applyMigrationOperation("Recovering migration state from ZK", 
zkMigrationClient::getOrCreateMigrationRecoveryState);
+            String maybeDone = 
migrationLeadershipState.initialZkMigrationComplete() ? "done" : "not done";
+            log.info("Initial migration of ZK metadata is {}.", maybeDone);
+
+            // Once we've recovered the migration state from ZK, install this 
class as a metadata publisher
+            // by calling the initialZkLoadHandler.
+            initialZkLoadHandler.accept(KRaftMigrationDriver.this);
+
+            // Transition to INACTIVE state and wait for leadership events.
+            transitionTo(MigrationDriverState.INACTIVE);
+        }
+    }
+
     class PollEvent extends MigrationEvent {
+
         @Override
         public void run() throws Exception {
             switch (migrationState) {
                 case UNINITIALIZED:
-                    recoverMigrationStateFromZK();
+                    eventQueue.append(new RecoverMigrationStateFromZKEvent());

Review Comment:
   On second thought, I don't think my question makes sense. The following 
`PollEvent` can only after `RecoverMigrationStateFromZKEvent` finishes.



-- 
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