chia7712 commented on code in PR #15732: URL: https://github.com/apache/kafka/pull/15732#discussion_r1570822868
########## 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); Review Comment: Should we add condition check (`checkDriverState`) like other events? ########## 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: Should we use `prepend` to make sure this event is executed ASAP -- 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