diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index f831d1a120..7d0cbee0de 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -423,6 +423,9 @@ Trunk (Unreleased) HADOOP-11653. shellprofiles should require .sh extension (Brahma Reddy Battula via aw) + HADOOP-11668. hadoop-daemons.sh bw compat broke with --slaves change + (Vinayakumar B via aw) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh index 9e4e6b00fa..2619ab798b 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh @@ -65,8 +65,13 @@ hadoop_error "WARNING: Attempting to execute replacement \"hdfs --slaves --daemo # we're going to turn this into # hdfs --slaves --daemon (start|stop) (rest of options) # -argv=(${HADOOP_USER_PARAMS[@]/start}) -argv=(${argv[@]/stop}) -argv=(${argv[@]/status}) +for (( i = 0; i < ${#HADOOP_USER_PARAMS[@]}; i++ )) +do + if [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^start$ ]] || + [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^stop$ ]] || + [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^status$ ]]; then + unset HADOOP_USER_PARAMS[$i] + fi +done -${hdfsscript} --slaves --daemon "${daemonmode}" "${argv[@]}" +${hdfsscript} --slaves --daemon "${daemonmode}" "${HADOOP_USER_PARAMS[@]}" diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh index 9488e3cd1d..8129c5c8a5 100644 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh @@ -415,7 +415,19 @@ function hadoop_common_slave_mode_execute # if --slaves is still on the command line, remove it # to prevent loops - argv=(${argv[@]/--slaves}) + # Also remove --hostnames and --hosts along with arg values + local argsSize=${#argv[@]}; + for (( i = 0; i < $argsSize; i++ )) + do + if [[ "${argv[$i]}" =~ ^--slaves$ ]]; then + unset argv[$i] + elif [[ "${argv[$i]}" =~ ^--hostnames$ ]] || + [[ "${argv[$i]}" =~ ^--hosts$ ]]; then + unset argv[$i]; + let i++; + unset argv[$i]; + fi + done hadoop_connect_to_hosts -- "${argv[@]}" } diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh index c6963d9883..75fb1f8205 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh @@ -55,9 +55,14 @@ hadoop_error "WARNING: Attempting to execute replacement \"yarn --slaves --daemo # we're going to turn this into # yarn --slaves --daemon (start|stop) (rest of options) # -argv=(${HADOOP_USER_PARAMS[@]/start}) -argv=(${argv[@]/stop}) -argv=(${argv[@]/status}) +for (( i = 0; i < ${#HADOOP_USER_PARAMS[@]}; i++ )) +do + if [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^start$ ]] || + [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^stop$ ]] || + [[ "${HADOOP_USER_PARAMS[$i]}" =~ ^status$ ]]; then + unset HADOOP_USER_PARAMS[$i] + fi +done -${yarnscript} --slaves --daemon "${daemonmode}" "${argv[@]}" +${yarnscript} --slaves --daemon "${daemonmode}" "${HADOOP_USER_PARAMS[@]}"