[MINOR] allow additional JVM args in KafkaService
Reviewers: Colin P. McCabe Vikas Singh
@@ -96,7 +96,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
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:
@@ -114,6 +114,8 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
: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 []),
@@ -138,6 +140,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
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
@@ -325,8 +328,8 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
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,
