mumrah commented on code in PR #12050:
URL: https://github.com/apache/kafka/pull/12050#discussion_r871494219


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -927,6 +981,31 @@ private void appendRaftEvent(String name, Runnable 
runnable) {
         }
     }
 
+    /**
+     * A callback for changes to feature levels including metadata.version. 
This is called synchronously from
+     * {@link FeatureControlManager#replay(FeatureLevelRecord)} which is part 
of a ControllerWriteEvent. It is safe
+     * to modify controller state here. By the time this listener is called, a 
FeatureLevelRecord has been committed and
+     * the in-memory state of FeatureControlManager has been updated.
+     */
+    class QuorumFeatureListener implements FeatureLevelListener {
+        @Override
+        public void handle(String featureName, short finalizedVersion) {
+            boolean isActiveController = curClaimEpoch != -1;
+            boolean isFeatureSupported = 
featureControl.canSupportVersion(featureName, finalizedVersion);
+            if (featureName.equals(MetadataVersion.FEATURE_NAME)) {
+                if (!isFeatureSupported) {
+                    if (isActiveController) {
+                        log.error("Active controller cannot support 
metadata.version {}", finalizedVersion);
+                    } else {
+                        log.error("Standby controller cannot support 
metadata.version {}, shutting down.", finalizedVersion);
+                    }
+                    beginShutdown();
+                }
+            }

Review Comment:
   Yea, that's a good point. If the controller receives a record for a feature 
it can't support it should probably shutdown.



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