From a6cb7df3c7d31138cc39625685c38ba0fd588bc5 Mon Sep 17 00:00:00 2001 From: shuozhang Date: Wed, 8 Jan 2020 20:24:10 -0500 Subject: [PATCH 1/3] Update shell scripts to support z/OS system --- bin/kafka-run-class.sh | 29 ++++++++++++++++++++--------- bin/kafka-server-start.sh | 4 ++++ bin/kafka-server-stop.sh | 6 +++++- bin/zookeeper-server-stop.sh | 6 +++++- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index 8cb57b4a338fe..def607aa89cb1 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -21,7 +21,7 @@ then fi # CYGWIN == 1 if Cygwin is detected, else 0. -if [[ $(uname -a) =~ "CYGWIN" ]]; then +if [[ $(uname -s) != "OS/390" ]] && [[ $(uname -a) =~ "CYGWIN" ]]; then CYGWIN=1 else CYGWIN=0 @@ -56,7 +56,10 @@ if [ -z "$SCALA_BINARY_VERSION" ]; then fi # run ./gradlew copyDependantLibs to get all dependant jars in a local dir -shopt -s nullglob +if [[ $(uname -s) != "OS/390" ]] ; then + shopt -s nullglob +fi + if [ -z "$UPGRADE_KAFKA_STREAMS_TEST_VERSION" ]; then for dir in "$base_dir"/core/build/dependant-libs-${SCALA_VERSION}*; do @@ -81,7 +84,6 @@ else streams_dependant_clients_lib_dir=$streams_lib_dir fi - for file in "$clients_lib_dir"/kafka-clients*.jar; do if should_include_file "$file"; then @@ -104,8 +106,8 @@ if [ -z "$UPGRADE_KAFKA_STREAMS_TEST_VERSION" ]; then fi done else - VERSION_NO_DOTS=`echo $UPGRADE_KAFKA_STREAMS_TEST_VERSION | sed 's/\.//g'` - SHORT_VERSION_NO_DOTS=${VERSION_NO_DOTS:0:((${#VERSION_NO_DOTS} - 1))} # remove last char, ie, bug-fix number + SHORT_VERSION=${UPGRADE_KAFKA_STREAMS_TEST_VERSION%.?} # remove last number, ie, bug-fix number + SHORT_VERSION_NO_DOTS=`echo $SHORT_VERSION | sed 's/\.//g'` for file in "$base_dir"/streams/upgrade-system-tests-$SHORT_VERSION_NO_DOTS/build/libs/kafka-streams-upgrade-system-tests*.jar; do if should_include_file "$file"; then @@ -171,7 +173,10 @@ do CLASSPATH="$CLASSPATH":"$file" fi done -shopt -u nullglob + +if [[ $(uname -s) != "OS/390" ]] ; then + shopt -u nullglob +fi if [ -z "$CLASSPATH" ] ; then echo "Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=$SCALA_VERSION'" @@ -198,7 +203,9 @@ if [ -z "$KAFKA_LOG4J_OPTS" ]; then # Log to console. This is a tool. LOG4J_DIR="$base_dir/config/tools-log4j.properties" # If Cygwin is detected, LOG4J_DIR is converted to Windows format. - (( CYGWIN )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}") + if [[ $(uname -s) != "OS/390" ]] ; then + (( CYGWIN )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}") + fi KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}" else # create logs directory @@ -208,7 +215,9 @@ else fi # If Cygwin is detected, LOG_DIR is converted to Windows format. -(( CYGWIN )) && LOG_DIR=$(cygpath --path --mixed "${LOG_DIR}") +if [[ $(uname -s) != "OS/390" ]] ; then + (( CYGWIN )) && LOG_DIR=$(cygpath --path --mixed "${LOG_DIR}") +fi KAFKA_LOG4J_OPTS="-Dkafka.logs.dir=$LOG_DIR $KAFKA_LOG4J_OPTS" # Generic jvm settings you want to add @@ -305,7 +314,9 @@ fi CLASSPATH=${CLASSPATH#:} # If Cygwin is detected, classpath is converted to Windows format. -(( CYGWIN )) && CLASSPATH=$(cygpath --path --mixed "${CLASSPATH}") +if [[ $(uname -s) != "OS/390" ]] ; then + (( CYGWIN )) && CLASSPATH=$(cygpath --path --mixed "${CLASSPATH}") +fi # Launch mode if [ "x$DAEMON_MODE" = "xtrue" ]; then diff --git a/bin/kafka-server-start.sh b/bin/kafka-server-start.sh index 5a53126172de9..f3c125376aa56 100755 --- a/bin/kafka-server-start.sh +++ b/bin/kafka-server-start.sh @@ -26,7 +26,11 @@ if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then fi if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then + if [[ $(uname -s) != "OS/390" ]] ; then export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" + else + export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G -Xnocompressedrefs" + fi fi EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'} diff --git a/bin/kafka-server-stop.sh b/bin/kafka-server-stop.sh index de263797916c0..cce02ac6f0187 100755 --- a/bin/kafka-server-stop.sh +++ b/bin/kafka-server-stop.sh @@ -14,7 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. SIGNAL=${SIGNAL:-TERM} -PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') +if [[ $(uname -s) != "OS/390" ]] ; then + PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') +else + PIDS=$(ps -A -o pid,jobname,comm | grep -i 'KAFKSTRT' | grep java | grep -v grep | awk '{print $1}') +fi if [ -z "$PIDS" ]; then echo "No kafka server to stop" diff --git a/bin/zookeeper-server-stop.sh b/bin/zookeeper-server-stop.sh index dcaa325a34a65..5d886208a58b2 100755 --- a/bin/zookeeper-server-stop.sh +++ b/bin/zookeeper-server-stop.sh @@ -14,7 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. SIGNAL=${SIGNAL:-TERM} -PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') +if [[ $(uname -s) != "OS/390" ]] ; then + PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') +else + PIDS=$(ps -A -o pid,jobname,comm | grep -i 'ZKEESTRT' | grep java | grep -v grep | awk '{print $1}') +fi if [ -z "$PIDS" ]; then echo "No zookeeper server to stop" From 92db9e758d7bf4422d17f179eeb19fb4479e7dce Mon Sep 17 00:00:00 2001 From: shuozhang Date: Mon, 3 Feb 2020 07:55:56 -0500 Subject: [PATCH 2/3] Update shell scripts to support z/OS system --- bin/kafka-run-class.sh | 29 +++++++++-------------------- bin/kafka-server-start.sh | 4 ---- bin/kafka-server-stop.sh | 11 ++++++++--- bin/zookeeper-server-stop.sh | 11 ++++++++--- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index def607aa89cb1..8cb57b4a338fe 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -21,7 +21,7 @@ then fi # CYGWIN == 1 if Cygwin is detected, else 0. -if [[ $(uname -s) != "OS/390" ]] && [[ $(uname -a) =~ "CYGWIN" ]]; then +if [[ $(uname -a) =~ "CYGWIN" ]]; then CYGWIN=1 else CYGWIN=0 @@ -56,10 +56,7 @@ if [ -z "$SCALA_BINARY_VERSION" ]; then fi # run ./gradlew copyDependantLibs to get all dependant jars in a local dir -if [[ $(uname -s) != "OS/390" ]] ; then - shopt -s nullglob -fi - +shopt -s nullglob if [ -z "$UPGRADE_KAFKA_STREAMS_TEST_VERSION" ]; then for dir in "$base_dir"/core/build/dependant-libs-${SCALA_VERSION}*; do @@ -84,6 +81,7 @@ else streams_dependant_clients_lib_dir=$streams_lib_dir fi + for file in "$clients_lib_dir"/kafka-clients*.jar; do if should_include_file "$file"; then @@ -106,8 +104,8 @@ if [ -z "$UPGRADE_KAFKA_STREAMS_TEST_VERSION" ]; then fi done else - SHORT_VERSION=${UPGRADE_KAFKA_STREAMS_TEST_VERSION%.?} # remove last number, ie, bug-fix number - SHORT_VERSION_NO_DOTS=`echo $SHORT_VERSION | sed 's/\.//g'` + VERSION_NO_DOTS=`echo $UPGRADE_KAFKA_STREAMS_TEST_VERSION | sed 's/\.//g'` + SHORT_VERSION_NO_DOTS=${VERSION_NO_DOTS:0:((${#VERSION_NO_DOTS} - 1))} # remove last char, ie, bug-fix number for file in "$base_dir"/streams/upgrade-system-tests-$SHORT_VERSION_NO_DOTS/build/libs/kafka-streams-upgrade-system-tests*.jar; do if should_include_file "$file"; then @@ -173,10 +171,7 @@ do CLASSPATH="$CLASSPATH":"$file" fi done - -if [[ $(uname -s) != "OS/390" ]] ; then - shopt -u nullglob -fi +shopt -u nullglob if [ -z "$CLASSPATH" ] ; then echo "Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=$SCALA_VERSION'" @@ -203,9 +198,7 @@ if [ -z "$KAFKA_LOG4J_OPTS" ]; then # Log to console. This is a tool. LOG4J_DIR="$base_dir/config/tools-log4j.properties" # If Cygwin is detected, LOG4J_DIR is converted to Windows format. - if [[ $(uname -s) != "OS/390" ]] ; then - (( CYGWIN )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}") - fi + (( CYGWIN )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}") KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}" else # create logs directory @@ -215,9 +208,7 @@ else fi # If Cygwin is detected, LOG_DIR is converted to Windows format. -if [[ $(uname -s) != "OS/390" ]] ; then - (( CYGWIN )) && LOG_DIR=$(cygpath --path --mixed "${LOG_DIR}") -fi +(( CYGWIN )) && LOG_DIR=$(cygpath --path --mixed "${LOG_DIR}") KAFKA_LOG4J_OPTS="-Dkafka.logs.dir=$LOG_DIR $KAFKA_LOG4J_OPTS" # Generic jvm settings you want to add @@ -314,9 +305,7 @@ fi CLASSPATH=${CLASSPATH#:} # If Cygwin is detected, classpath is converted to Windows format. -if [[ $(uname -s) != "OS/390" ]] ; then - (( CYGWIN )) && CLASSPATH=$(cygpath --path --mixed "${CLASSPATH}") -fi +(( CYGWIN )) && CLASSPATH=$(cygpath --path --mixed "${CLASSPATH}") # Launch mode if [ "x$DAEMON_MODE" = "xtrue" ]; then diff --git a/bin/kafka-server-start.sh b/bin/kafka-server-start.sh index f3c125376aa56..5a53126172de9 100755 --- a/bin/kafka-server-start.sh +++ b/bin/kafka-server-start.sh @@ -26,11 +26,7 @@ if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then fi if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then - if [[ $(uname -s) != "OS/390" ]] ; then export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" - else - export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G -Xnocompressedrefs" - fi fi EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'} diff --git a/bin/kafka-server-stop.sh b/bin/kafka-server-stop.sh index cce02ac6f0187..cb0d930e92407 100755 --- a/bin/kafka-server-stop.sh +++ b/bin/kafka-server-stop.sh @@ -14,10 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. SIGNAL=${SIGNAL:-TERM} -if [[ $(uname -s) != "OS/390" ]] ; then - PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') + +if [ -z $JOBNAME ];then + JOBNAME="KAFKSTRT" +fi + +if [[ $(uname -s) == "OS/390" ]] ; then + PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') else - PIDS=$(ps -A -o pid,jobname,comm | grep -i 'KAFKSTRT' | grep java | grep -v grep | awk '{print $1}') + PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') fi if [ -z "$PIDS" ]; then diff --git a/bin/zookeeper-server-stop.sh b/bin/zookeeper-server-stop.sh index 5d886208a58b2..5f5c95a6e90c3 100755 --- a/bin/zookeeper-server-stop.sh +++ b/bin/zookeeper-server-stop.sh @@ -14,10 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. SIGNAL=${SIGNAL:-TERM} -if [[ $(uname -s) != "OS/390" ]] ; then - PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') + +if [ -z $JOBNAME ];then + JOBNAME="ZKEESTRT" +fi + +if [[ $(uname -s) == "OS/390" ]] ; then + PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') else - PIDS=$(ps -A -o pid,jobname,comm | grep -i 'ZKEESTRT' | grep java | grep -v grep | awk '{print $1}') + PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') fi if [ -z "$PIDS" ]; then From 6f930aec02394126e9907d73dc7697a8a8924332 Mon Sep 17 00:00:00 2001 From: shuozhang Date: Fri, 7 Feb 2020 03:00:39 -0500 Subject: [PATCH 3/3] Update shell scripts to support z/OS system --- bin/kafka-server-stop.sh | 11 +++++------ bin/zookeeper-server-stop.sh | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/bin/kafka-server-stop.sh b/bin/kafka-server-stop.sh index cb0d930e92407..1e5de0ebb00b3 100755 --- a/bin/kafka-server-stop.sh +++ b/bin/kafka-server-stop.sh @@ -15,14 +15,13 @@ # limitations under the License. SIGNAL=${SIGNAL:-TERM} -if [ -z $JOBNAME ];then +if [[ $(uname -s) == "OS/390" ]]; then + if [ -z $JOBNAME ]; then JOBNAME="KAFKSTRT" -fi - -if [[ $(uname -s) == "OS/390" ]] ; then - PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') + fi + PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') else - PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') + PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}') fi if [ -z "$PIDS" ]; then diff --git a/bin/zookeeper-server-stop.sh b/bin/zookeeper-server-stop.sh index 5f5c95a6e90c3..324da4123bf2e 100755 --- a/bin/zookeeper-server-stop.sh +++ b/bin/zookeeper-server-stop.sh @@ -15,14 +15,13 @@ # limitations under the License. SIGNAL=${SIGNAL:-TERM} -if [ -z $JOBNAME ];then +if [[ $(uname -s) == "OS/390" ]]; then + if [ -z $JOBNAME ]; then JOBNAME="ZKEESTRT" -fi - -if [[ $(uname -s) == "OS/390" ]] ; then - PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') + fi + PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') else - PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') + PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') fi if [ -z "$PIDS" ]; then