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


##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -232,13 +248,20 @@ private ApiError updateMetadataVersion(
         Consumer<ApiMessageAndVersion> recordConsumer
     ) {
         MetadataVersion currentVersion = metadataVersion();
+        ZkMigrationState zkMigrationState = zkMigrationState();
         final MetadataVersion newVersion;
         try {
             newVersion = MetadataVersion.fromFeatureLevel(newVersionLevel);
         } catch (IllegalArgumentException e) {
             return invalidMetadataVersion(newVersionLevel, "Unknown 
metadata.version.");
         }
 
+        // Don't allow metadata.version changes while we're migrating
+        if (EnumSet.of(ZkMigrationState.PRE_MIGRATION, 
ZkMigrationState.MIGRATION).contains(zkMigrationState)) {

Review Comment:
   Hmm, seems like this might come up in a bunch of places. Maybe we can have a 
member function in `ZkMigrationState.java` like ````
   boolean inProgress() { return this == PRE_MIGRATION || this == 
POST_MIGRATION; }
   ```



##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -232,13 +248,20 @@ private ApiError updateMetadataVersion(
         Consumer<ApiMessageAndVersion> recordConsumer
     ) {
         MetadataVersion currentVersion = metadataVersion();
+        ZkMigrationState zkMigrationState = zkMigrationState();
         final MetadataVersion newVersion;
         try {
             newVersion = MetadataVersion.fromFeatureLevel(newVersionLevel);
         } catch (IllegalArgumentException e) {
             return invalidMetadataVersion(newVersionLevel, "Unknown 
metadata.version.");
         }
 
+        // Don't allow metadata.version changes while we're migrating
+        if (EnumSet.of(ZkMigrationState.PRE_MIGRATION, 
ZkMigrationState.MIGRATION).contains(zkMigrationState)) {

Review Comment:
   Hmm, seems like this might come up in a bunch of places. Maybe we can have a 
member function in `ZkMigrationState.java` like 
   ```
   boolean inProgress() { return this == PRE_MIGRATION || this == 
POST_MIGRATION; }
   ```



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