diff --git a/metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java b/metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java index 61b95c091d6dc..ac63a66a08934 100644 --- a/metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java +++ b/metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java @@ -359,6 +359,9 @@ public String name() { @Override public void onControllerChange(LeaderAndEpoch newLeaderAndEpoch) { curLeaderAndEpoch = newLeaderAndEpoch; + if (migrationState.equals(MigrationDriverState.UNINITIALIZED)) { + eventQueue.append(new RecoverMigrationStateFromZKEvent()); + } eventQueue.append(new KRaftLeaderEvent(newLeaderAndEpoch)); }