mirror of https://github.com/apache/kafka.git
MINOR: Do not wait for first line of console consumer output since we now have a more reliable test using JMX
Waiting for the first line of output was added in KAFKA-2527 when JmxMixin was originally added as a heuristic to determine when the process was ready. We've since determined this is not good enough given JmxTool's limitations and now include a separate, more reliable check before starting JmxTool. This check is also dangerous since a consumer that is started before data is available in the topic, it won't output anything to stdout and only logs errors to a separate log file. This means we may have a long delay between starting the process and starting JMX monitoring. Since we have a more reliable check for liveness via JMX now (and in cases that need it, partition assignment metrics via JMX), we should no longer need to wait for the first line of output. Author: Ewen Cheslack-Postava <me@ewencp.org> Reviewers: Ismael Juma <ismael@juma.me.uk>, Apurva Mehta <apurva@confluent.io> Closes #3447 from ewencp/dont-wait-first-line-console-consumer
This commit is contained in:
parent
28c83d9667
commit
d663005fdd
|
@ -255,14 +255,12 @@ class ConsoleConsumer(KafkaPathResolverMixin, JmxMixin, BackgroundThreadService)
|
|||
self.logger.debug("Console consumer %d command: %s", idx, cmd)
|
||||
|
||||
consumer_output = node.account.ssh_capture(cmd, allow_fail=False)
|
||||
first_line = next(consumer_output, None)
|
||||
|
||||
if first_line is not None:
|
||||
self.logger.debug("collecting following jmx objects: %s", self.jmx_object_names)
|
||||
self.init_jmx_attributes()
|
||||
self.logger.debug("collecting following jmx objects: %s", self.jmx_object_names)
|
||||
self.start_jmx_tool(idx, node)
|
||||
|
||||
for line in itertools.chain([first_line], consumer_output):
|
||||
for line in consumer_output:
|
||||
msg = line.strip()
|
||||
if msg == "shutdown_complete":
|
||||
# Note that we can only rely on shutdown_complete message if running 0.10.0 or greater
|
||||
|
|
Loading…
Reference in New Issue