@Override
            public ZkMigrationLeadershipState getOrCreateMigrationRecoveryState(ZkMigrationLeadershipState initialState) {
                if (createZnodeAttempts.getCount() == 0) {
                    this.setMigrationRecoveryState(initialState);
                    return initialState;
                } else {
                    createZnodeAttempts.countDown();
                    throw new MigrationClientException("Some kind of ZK error!");
                }
            }
Don't send RPCs to brokers for every metadata change, only when brokers or topics change.
This is a regression test for KAFKA-14668
metadata/src/test/java/org/apache/kafka/metadata/migration/KRaftMigrationDriverTest.java