Plucas has uploaded a new change for review.
https://gerrit.wikimedia.org/r/148287
Change subject: Fix debian/bin/kafka
......................................................................
Fix debian/bin/kafka
Fix errors in bin/kafka introduced in [1]:
- Use /bin/bash instead of /bin/sh to avoid quoting issues
- Use bash arrays instead of strings for building argument lists
- Expand arg array when calling kafka_run_class
The immediate symptom this fixes is that in cmd_server_start and
cmd_zookeeper_start, arguments to kafka_run_class were collected in a
string variable $EXTRA_ARGS and then passed without expansion to
kafka_run_class, eg.:
kafka_run_class "${EXTRA_ARGS}" kafka.Kafka "${server_properties}"
Thus, in kafka_run_class, $1 was equal in most cases to the string:
"-daemon -name kafkaServer -loggc"
This string as a whole, then, was not matched by anything in the case
statement responsible for parsing the arguments separately. Thus, there
was no call to 'shift', and the string was passed to the java invocation
as a part of "$@".
Since -name and -loggc aren't valid options to the java executable, the
command failed.
[1]Iad14021b9c8e7893f44c12b8ec280f5cbb84d4fe
Change-Id: Id096b623144a2fe34d63507f9b76c46183c417a4
---
M debian/bin/kafka
1 file changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/debs/kafka
refs/changes/87/148287/1
diff --git a/debian/bin/kafka b/debian/bin/kafka
index e6c1ea1..ec88102 100755
--- a/debian/bin/kafka
+++ b/debian/bin/kafka
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# kafka
#
@@ -192,7 +192,7 @@
export JMX_PORT="${JMX_PORT:-9993}"
export
KAFKA_LOG4J_OPTS="${KAFKA_LOG4J_OPTS:--Dlog4j.configuration=file:${KAFKA_CONFIG}/log4j.properties}"
export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1G -Xms1G}"
- kafka_run_class daemon kafkaMirror kafka.tools.MirrorMaker "$@"
+ kafka_run_class -daemon kafkaMirror kafka.tools.MirrorMaker "$@"
}
cmd_consumer_offset_checker() {
@@ -235,12 +235,12 @@
}
cmd_server_start() {
- EXTRA_ARGS="-name kafkaServer -loggc"
+ EXTRA_ARGS=(-name kafkaServer -loggc)
COMMAND=$1
case $COMMAND in
-daemon)
- EXTRA_ARGS="-daemon "$EXTRA_ARGS
+ EXTRA_ARGS=(-daemon "${EXTRA_ARGS[@]}")
shift
;;
*)
@@ -254,7 +254,7 @@
export
KAFKA_LOG4J_OPTS="${KAFKA_LOG4J_OPTS:--Dlog4j.configuration=file:${KAFKA_CONFIG}/log4j.properties}"
export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1G -Xms1G}"
- kafka_run_class "${EXTRA_ARGS}" kafka.Kafka "${server_properties}"
+ kafka_run_class "${EXTRA_ARGS[@]}" kafka.Kafka "${server_properties}"
}
cmd_server_stop() {
@@ -264,12 +264,12 @@
}
cmd_zookeeper_start() {
- EXTRA_ARGS="-name zookeeper -loggc"
+ EXTRA_ARGS=(-name kafkaServer -loggc)
COMMAND=$1
case "${COMMAND}" in
- -daemon)
- EXTRA_ARGS="-daemon ${EXTRA_ARGS}"
+ -daemon)
+ EXTRA_ARGS=(-daemon "${EXTRA_ARGS[@]}")
shift
;;
*)
@@ -283,7 +283,7 @@
export
KAFKA_LOG4J_OPTS="${KAFKA_LOG4J_OPTS:--Dlog4j.configuration=file:${KAFKA_CONFIG}/log4j.properties}"
export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx512M -Xms512M}"
- kafka_run_class "${EXTRA_ARGS}"
org.apache.zookeeper.server.quorum.QuorumPeerMain "${zookeeper_properties}"
+ kafka_run_class "${EXTRA_ARGS[@]}"
org.apache.zookeeper.server.quorum.QuorumPeerMain "${zookeeper_properties}"
}
cmd_zookeeper_stop() {
--
To view, visit https://gerrit.wikimedia.org/r/148287
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id096b623144a2fe34d63507f9b76c46183c417a4
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/kafka
Gerrit-Branch: debian
Gerrit-Owner: Plucas <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits