Skip to content

Commit

Permalink
[MINOR] allow additional JVM args in KafkaService (#7297)
Browse files Browse the repository at this point in the history
Reviewers: Colin P. McCabe <[email protected]>, Vikas Singh <[email protected]>
  • Loading branch information
a0x8o committed Nov 18, 2019
1 parent a6f708d commit 12fdf40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/kafkatest/services/kafka/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI
client_sasl_mechanism=SecurityConfig.SASL_MECHANISM_GSSAPI, interbroker_sasl_mechanism=SecurityConfig.SASL_MECHANISM_GSSAPI,
authorizer_class_name=None, topics=None, version=DEV_BRANCH, jmx_object_names=None,
jmx_attributes=None, zk_connect_timeout=5000, zk_session_timeout=6000, server_prop_overides=None, zk_chroot=None,
listener_security_config=ListenerSecurityConfig(), per_node_server_prop_overrides={}):
listener_security_config=ListenerSecurityConfig(), per_node_server_prop_overrides={}, extra_kafka_opts=""):
"""
:param context: test context
:param ZookeeperService zk:
Expand All @@ -114,6 +114,8 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI
:param dict server_prop_overides: overrides for kafka.properties file
:param zk_chroot:
:param ListenerSecurityConfig listener_security_config: listener config to use
:param dict per_node_server_prop_overrides:
:param str extra_kafka_opts: jvm args to add to KAFKA_OPTS variable
"""
Service.__init__(self, context, num_nodes)
JmxMixin.__init__(self, num_nodes=num_nodes, jmx_object_names=jmx_object_names, jmx_attributes=(jmx_attributes or []),
Expand All @@ -138,6 +140,7 @@ def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAI
self.log_level = "DEBUG"
self.zk_chroot = zk_chroot
self.listener_security_config = listener_security_config
self.extra_kafka_opts = extra_kafka_opts

#
# In a heavily loaded and not very fast machine, it is
Expand Down Expand Up @@ -325,8 +328,8 @@ def start_cmd(self, node):
cmd += "export KAFKA_LOG4J_OPTS=\"-Dlog4j.configuration=file:%s\"; " % self.LOG4J_CONFIG
heap_kafka_opts = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%s" % \
self.logs["kafka_heap_dump_file"]["path"]
other_kafka_opts = self.security_config.kafka_opts.strip('\"')
cmd += "export KAFKA_OPTS=\"%s %s\"; " % (heap_kafka_opts, other_kafka_opts)
security_kafka_opts = self.security_config.kafka_opts.strip('\"')
cmd += "export KAFKA_OPTS=\"%s %s %s\"; " % (heap_kafka_opts, security_kafka_opts, extra_kafka_opts)
cmd += "%s %s 1>> %s 2>> %s &" % \
(self.path.script("kafka-server-start.sh", node),
KafkaService.CONFIG_FILE,
Expand Down

0 comments on commit 12fdf40

Please sign in to comment.