Repository: kafka Updated Branches: refs/heads/1.0 e0fcc7191 -> 91eb178e9
MINOR: reset state in cleanup, fixes jmx mixin flakiness ewencp ijuma Author: Xavier Léauté <[email protected]> Author: Ewen Cheslack-Postava <[email protected]> Reviewers: Ewen Cheslack-Postava <[email protected]> Closes #4123 from xvrl/fix-jmx-flakiness Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/91eb178e Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/91eb178e Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/91eb178e Branch: refs/heads/1.0 Commit: 91eb178e95abd71b68dd03ee25c77482087bd9bb Parents: e0fcc71 Author: Xavier Léauté <[email protected]> Authored: Wed Oct 25 13:34:15 2017 -0700 Committer: Ewen Cheslack-Postava <[email protected]> Committed: Wed Oct 25 13:34:15 2017 -0700 ---------------------------------------------------------------------- tests/kafkatest/services/console_consumer.py | 10 ++++++---- tests/kafkatest/services/monitor/jmx.py | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/91eb178e/tests/kafkatest/services/console_consumer.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/console_consumer.py b/tests/kafkatest/services/console_consumer.py index 556f43a..950ded3 100644 --- a/tests/kafkatest/services/console_consumer.py +++ b/tests/kafkatest/services/console_consumer.py @@ -313,9 +313,11 @@ class ConsoleConsumer(KafkaPathResolverMixin, JmxMixin, BackgroundThreadService) def _init_jmx_attributes(self): # Must hold lock if self.new_consumer: - if not self.jmx_object_names: - self.jmx_object_names = [] - self.jmx_object_names += ["kafka.consumer:type=consumer-coordinator-metrics,client-id=%s" % self.client_id] - self.jmx_attributes += ["assigned-partitions"] + # We use a flag to track whether we're using this automatically generated ID because the service could be + # restarted multiple times and the client ID may be changed. + if getattr(self, '_automatic_metrics', False) or not self.jmx_object_names: + self._automatic_metrics = True + self.jmx_object_names = ["kafka.consumer:type=consumer-coordinator-metrics,client-id=%s" % self.client_id] + self.jmx_attributes = ["assigned-partitions"] self.assigned_partitions_jmx_attr = "kafka.consumer:type=consumer-coordinator-metrics,client-id=%s:assigned-partitions" % self.client_id http://git-wip-us.apache.org/repos/asf/kafka/blob/91eb178e/tests/kafkatest/services/monitor/jmx.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/monitor/jmx.py b/tests/kafkatest/services/monitor/jmx.py index 36df21b..6f6e221 100644 --- a/tests/kafkatest/services/monitor/jmx.py +++ b/tests/kafkatest/services/monitor/jmx.py @@ -43,6 +43,8 @@ class JmxMixin(object): def clean_node(self, node): node.account.kill_java_processes(self.jmx_class_name(), clean_shutdown=False, allow_fail=True) + idx = self.idx(node) + self.started[idx-1] = False node.account.ssh("rm -f -- %s %s" % (self.jmx_tool_log, self.jmx_tool_err_log), allow_fail=False) def start_jmx_tool(self, idx, node):
