soarez commented on code in PR #15754:
URL: https://github.com/apache/kafka/pull/15754#discussion_r1574994375


##########
tests/kafkatest/tests/core/zookeeper_migration_test.py:
##########
@@ -86,10 +87,35 @@ def do_migration(self, roll_controller = False, 
downgrade_to_zk = False):
                 controller.stop_node(node)
                 controller.start_node(node)
 
+        if downgrade_to_zk:
+            self.logger.info("Shutdown brokers to avoid waiting on unclean 
shutdown")
+            for node in self.kafka.nodes:
+                self.kafka.stop_node(node)
+                metadata_log_dir = KafkaService.METADATA_LOG_DIR + 
"/__cluster_metadata-0"
+                for node in self.kafka.nodes:
+                    assert path_exists(node, metadata_log_dir), "Should still 
have a metadata log on the brokers."
+
+            self.logger.info("Shutdown KRaft quorum")
+            for node in controller.nodes:
+                controller.stop_node(node)
+
+            self.logger.info("Deleting controller ZNode")
+            self.zk.delete(path="/controller", recursive=True)
+
+            self.logger.info("Rolling brokers back to ZK mode")
+            self.kafka.downgrade_kraft_broker_to_zk(controller)
+            for node in self.kafka.nodes:
+                self.kafka.start_node(node)
+
+            # This blocks until all brokers have a full ISR
+            self.wait_until_rejoin()

Review Comment:
   The test name is `test_online_migration` but we're shutting every broker 
down to apply the downgrade, it seems like a contradiction? Does the downgrade 
require a full shutdown of the cluster?



##########
tests/kafkatest/services/kafka/kafka.py:
##########
@@ -463,6 +463,18 @@ def reconfigure_zk_for_migration(self, kraft_quorum):
         # This is not added to "advertised.listeners" because of 
configured_for_zk_migration=True
         self.port_mappings[kraft_quorum.controller_listener_names] = 
kraft_quorum.port_mappings.get(kraft_quorum.controller_listener_names)
 
+    def downgrade_kraft_broker_to_zk(self, kraft_quorum):
+        self.configured_for_zk_migration = True
+        self.quorum_info = quorum.ServiceQuorumInfo(quorum.zk, self)
+        self.controller_quorum = kraft_quorum
+
+        # Set the migration properties
+        self.server_prop_overrides.extend([
+            ["zookeeper.metadata.migration.enable", "true"],
+            ["controller.quorum.voters", 
kraft_quorum.controller_quorum_voters],
+            ["controller.listener.names", 
kraft_quorum.controller_listener_names]
+        ])

Review Comment:
   In https://kafka.apache.org/documentation/#kraft_zk_migration under 
"Reverting to ZooKeeper mode During the Migration" we say:
   
   > On each broker, remove the zookeeper.metadata.migration.enable, 
controller.listener.names, and controller.quorum.voters configurations.
   
   And before this method is called we log `"Rolling brokers back to ZK mode"`.
   
   I'm guessing I'm probably missing something, shouldn't these three 
properties be removed?



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