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


##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -284,6 +334,120 @@ FinalizedControllerFeatures finalizedFeatures(long epoch) 
{
         return new FinalizedControllerFeatures(features, epoch);
     }
 
+
+    /**
+     * Optionally provides a ZkMigrationStateRecord to bootstrap into the 
metadata log. In the case of
+     * upgrades, the log will not be empty and this will return a NONE state 
record. For an empty log,
+     * this will return either a NONE or PRE_MIGRATION depending on the 
configuration and metadata.version.
+     * <p>
+     * If the log is in PRE_MIGRATION, this will throw an error.
+     *
+     * @param metadataVersion       The current MetadataVersion of the log
+     * @param isMetadataLogEmpty    True if the log is being initialized from 
empty
+     * @param recordConsumer        A consumer for the ZkMigrationStateRecord
+     */
+    public void generateZkMigrationRecord(

Review Comment:
   I don't think this logic belongs here.
   
   If you think about the way state transitions are driven you have:
   
   1. NONE -> PRE_MIGRATION
   This happens when the QuorumController (QC) starts up, sees the log is empty 
and `zookeeper.metadata.migration.enable = true`. QC adds a Zk migration state 
record to its activation records and replays them.
   
   2. PRE_MIGRATION -> MIGRATION
   This is driven by the ZK load process finishing, so there needs to be a 
callback in here for that.
   
   3. MIGRATION -> POST_MIGRATION
   This happens when the QuorumController (QC) starts up, sees that 
`zookeeper.metadata.migration.enable = false`, but we're in MIGRATION. QC adds 
a Zk migration state record to its activation records and replays them.
   
   FeatureControlManager can't really do any of those 3 on its own, it has to 
be told by QC what is going on.



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