jsancio commented on a change in pull request #11238:
URL: https://github.com/apache/kafka/pull/11238#discussion_r800260558
##########
File path: tests/kafkatest/services/kafka/kafka.py
##########
@@ -858,12 +859,27 @@ def signal_leader(self, topic, partition=0,
sig=signal.SIGTERM):
leader = self.leader(topic, partition)
self.signal_node(leader, sig)
+ def controllers_required_for_quorum(self):
+ """
+ Assume N = the total number of controller nodes in the cluster, and
positive
+ For N=1, we need 1 controller to be running to have a quorum
+ For N=2, we need 2 controllers
+ For N=3, we need 2 controllers
+ For N=4, we need 3 controllers
+ For N=5, we need 3 controllers
+
+ :return: the number of controller nodes that must be started for there
to be a quorum
+ """
+ # Note that we use math.ceil() to avoid floating point rounding issues
+ # associated with round() (e.g. round(5/2) yields 2 instead of 3)
Review comment:
I would remove this comment. The code after this PR doesn't use `round`.
##########
File path: tests/kafkatest/services/kafka/kafka.py
##########
@@ -858,12 +859,27 @@ def signal_leader(self, topic, partition=0,
sig=signal.SIGTERM):
leader = self.leader(topic, partition)
self.signal_node(leader, sig)
+ def controllers_required_for_quorum(self):
+ """
+ Assume N = the total number of controller nodes in the cluster, and
positive
+ For N=1, we need 1 controller to be running to have a quorum
+ For N=2, we need 2 controllers
+ For N=3, we need 2 controllers
+ For N=4, we need 3 controllers
+ For N=5, we need 3 controllers
+
+ :return: the number of controller nodes that must be started for there
to be a quorum
+ """
+ # Note that we use math.ceil() to avoid floating point rounding issues
+ # associated with round() (e.g. round(5/2) yields 2 instead of 3)
+ return math.ceil((1 + self.num_nodes_controller_role) / 2)
+
def stop_node(self, node, clean_shutdown=True, timeout_sec=60):
Review comment:
It is unfortunate that we need to add code that ignores and overrides
the `clean_shutdown` flag. Do you know why system tests are attempting to clean
shutdown when there is no controller quorum? For example, should the test be
fixed to instead be configured to have enough controllers to allow clean
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]