From ba1ceea6d3126e3f6bff427f7f5a1dcb705fe402 Mon Sep 17 00:00:00 2001 From: Jay Kreps Date: Fri, 11 Oct 2013 15:20:46 -0700 Subject: [PATCH] KAFKA-1081 Remove re-run functionality from start script and use exec to launch commands to avoid spurious .sh process. --- bin/kafka-add-partitions.sh | 2 +- bin/kafka-console-consumer.sh | 2 +- bin/kafka-console-producer.sh | 2 +- bin/kafka-consumer-perf-test.sh | 2 +- bin/kafka-create-topic.sh | 2 +- bin/kafka-list-topic.sh | 2 +- bin/kafka-preferred-replica-election.sh | 2 +- bin/kafka-producer-perf-test.sh | 2 +- bin/kafka-reassign-partitions.sh | 2 +- bin/kafka-replay-log-producer.sh | 2 +- bin/kafka-run-class.sh | 18 ++---------------- bin/kafka-server-start.sh | 2 +- bin/kafka-simple-consumer-perf-test.sh | 2 +- bin/kafka-simple-consumer-shell.sh | 2 +- bin/zookeeper-server-start.sh | 2 +- bin/zookeeper-shell.sh | 2 +- 16 files changed, 17 insertions(+), 31 deletions(-) diff --git a/bin/kafka-add-partitions.sh b/bin/kafka-add-partitions.sh index c08b837..a4839ba 100755 --- a/bin/kafka-add-partitions.sh +++ b/bin/kafka-add-partitions.sh @@ -15,4 +15,4 @@ # limitations under the License. base_dir=$(dirname $0) -$base_dir/kafka-run-class.sh kafka.admin.AddPartitionsCommand $@ +exec $base_dir/kafka-run-class.sh kafka.admin.AddPartitionsCommand $@ diff --git a/bin/kafka-console-consumer.sh b/bin/kafka-console-consumer.sh index 95edc9e..b86ea56 100755 --- a/bin/kafka-console-consumer.sh +++ b/bin/kafka-console-consumer.sh @@ -15,4 +15,4 @@ # limitations under the License. export KAFKA_HEAP_OPTS="-Xmx512M" -$(dirname $0)/kafka-run-class.sh kafka.consumer.ConsoleConsumer $@ +exec $(dirname $0)/kafka-run-class.sh kafka.consumer.ConsoleConsumer $@ diff --git a/bin/kafka-console-producer.sh b/bin/kafka-console-producer.sh index f102c22..ec0f21f 100755 --- a/bin/kafka-console-producer.sh +++ b/bin/kafka-console-producer.sh @@ -15,4 +15,4 @@ # limitations under the License. export KAFKA_HEAP_OPTS="-Xmx512M" -$(dirname $0)/kafka-run-class.sh kafka.producer.ConsoleProducer $@ +exec $(dirname $0)/kafka-run-class.sh kafka.producer.ConsoleProducer $@ diff --git a/bin/kafka-consumer-perf-test.sh b/bin/kafka-consumer-perf-test.sh index 39434d1..38c56c7 100755 --- a/bin/kafka-consumer-perf-test.sh +++ b/bin/kafka-consumer-perf-test.sh @@ -15,4 +15,4 @@ # limitations under the License. export KAFKA_HEAP_OPTS="-Xmx512M" -$(dirname $0)/kafka-run-class.sh kafka.perf.ConsumerPerformance $@ +exec $(dirname $0)/kafka-run-class.sh kafka.perf.ConsumerPerformance $@ diff --git a/bin/kafka-create-topic.sh b/bin/kafka-create-topic.sh index 7a5f297..a08bd88 100755 --- a/bin/kafka-create-topic.sh +++ b/bin/kafka-create-topic.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.admin.CreateTopicCommand $@ +exec $(dirname $0)/kafka-run-class.sh kafka.admin.CreateTopicCommand $@ diff --git a/bin/kafka-list-topic.sh b/bin/kafka-list-topic.sh index bb2dde5..b8c0ed3 100755 --- a/bin/kafka-list-topic.sh +++ b/bin/kafka-list-topic.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.admin.ListTopicCommand $@ +exec $(dirname $0)/kafka-run-class.sh kafka.admin.ListTopicCommand $@ diff --git a/bin/kafka-preferred-replica-election.sh b/bin/kafka-preferred-replica-election.sh index 6416dc1..ed167c2 100755 --- a/bin/kafka-preferred-replica-election.sh +++ b/bin/kafka-preferred-replica-election.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.admin.PreferredReplicaLeaderElectionCommand $@ +exec $(dirname $0)/kafka-run-class.sh kafka.admin.PreferredReplicaLeaderElectionCommand $@ diff --git a/bin/kafka-producer-perf-test.sh b/bin/kafka-producer-perf-test.sh index 1935522..d75ab7d 100755 --- a/bin/kafka-producer-perf-test.sh +++ b/bin/kafka-producer-perf-test.sh @@ -15,4 +15,4 @@ # limitations under the License. export KAFKA_HEAP_OPTS="-Xmx512M" -$(dirname $0)/kafka-run-class.sh kafka.perf.ProducerPerformance $@ +exec $(dirname $0)/kafka-run-class.sh kafka.perf.ProducerPerformance $@ diff --git a/bin/kafka-reassign-partitions.sh b/bin/kafka-reassign-partitions.sh index a6bd148..95b4ae0 100755 --- a/bin/kafka-reassign-partitions.sh +++ b/bin/kafka-reassign-partitions.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.admin.ReassignPartitionsCommand $@ +exec $(dirname $0)/kafka-run-class.sh kafka.admin.ReassignPartitionsCommand $@ diff --git a/bin/kafka-replay-log-producer.sh b/bin/kafka-replay-log-producer.sh index 86943ee..8e2e713 100755 --- a/bin/kafka-replay-log-producer.sh +++ b/bin/kafka-replay-log-producer.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.tools.ReplayLogProducer $@ +exec $(dirname $0)/kafka-run-class.sh kafka.tools.ReplayLogProducer $@ diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index eb6ff1b..2ef75e4 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -88,7 +88,7 @@ fi # JVM performance options if [ -z "$KAFKA_JVM_PERFORMANCE_OPTS" ]; then - KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseCompressedOops -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:+DisableExplicitGC" + KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseCompressedOops -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:+DisableExplicitGC -Djava.awt.headless=true" fi # GC options @@ -101,20 +101,6 @@ if [ "$1" = "daemon" ] && [ -z "$KAFKA_GC_LOG_OPTS"] ; then KAFKA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps " fi -$JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" - -exitval=$? - -if [ $exitval -eq "1" ] ; then - $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" >& exception.txt - exception=`cat exception.txt` - noBuildMessage='Please build the project using sbt. Documentation is available at http://kafka.apache.org/' - pattern="(Could not find or load main class)|(java\.lang\.NoClassDefFoundError)" - match=`echo $exception | grep -E "$pattern"` - if [[ -n "$match" ]]; then - echo $noBuildMessage - fi - rm exception.txt -fi +exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" diff --git a/bin/kafka-server-start.sh b/bin/kafka-server-start.sh index 4005289..4a36b2d 100755 --- a/bin/kafka-server-start.sh +++ b/bin/kafka-server-start.sh @@ -22,4 +22,4 @@ fi base_dir=$(dirname $0) export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" -$base_dir/kafka-run-class.sh daemon kafkaServer kafka.Kafka $@ +exec $base_dir/kafka-run-class.sh daemon kafkaServer kafka.Kafka $@ diff --git a/bin/kafka-simple-consumer-perf-test.sh b/bin/kafka-simple-consumer-perf-test.sh index 94c9ed0..c466cc8 100755 --- a/bin/kafka-simple-consumer-perf-test.sh +++ b/bin/kafka-simple-consumer-perf-test.sh @@ -15,4 +15,4 @@ # limitations under the License. export KAFKA_HEAP_OPTS="-Xmx512M" -$(dirname $0)/kafka-run-class.sh kafka.perf.SimpleConsumerPerformance $@ +exec $(dirname $0)/kafka-run-class.sh kafka.perf.SimpleConsumerPerformance $@ diff --git a/bin/kafka-simple-consumer-shell.sh b/bin/kafka-simple-consumer-shell.sh index 8d69357..9316f79 100755 --- a/bin/kafka-simple-consumer-shell.sh +++ b/bin/kafka-simple-consumer-shell.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -$(dirname $0)/kafka-run-class.sh kafka.tools.SimpleConsumerShell $@ +exec $(dirname $0)/kafka-run-class.sh kafka.tools.SimpleConsumerShell $@ diff --git a/bin/zookeeper-server-start.sh b/bin/zookeeper-server-start.sh index e4746a8..cdbbf33 100755 --- a/bin/zookeeper-server-start.sh +++ b/bin/zookeeper-server-start.sh @@ -22,5 +22,5 @@ fi base_dir=$(dirname $0) export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" export KAFKA_HEAP_OPTS="-Xmx512M -Xms512M" -$base_dir/kafka-run-class.sh daemon zookeeper org.apache.zookeeper.server.quorum.QuorumPeerMain $@ +exec $base_dir/kafka-run-class.sh daemon zookeeper org.apache.zookeeper.server.quorum.QuorumPeerMain $@ diff --git a/bin/zookeeper-shell.sh b/bin/zookeeper-shell.sh index e0de33f..92cce76 100755 --- a/bin/zookeeper-shell.sh +++ b/bin/zookeeper-shell.sh @@ -20,4 +20,4 @@ then exit 1 fi -$(dirname $0)/kafka-run-class.sh org.apache.zookeeper.ZooKeeperMain -server $1 \ No newline at end of file +exec $(dirname $0)/kafka-run-class.sh org.apache.zookeeper.ZooKeeperMain -server $1 \ No newline at end of file -- 1.7.12.4 (Apple Git-37)