HADOOP-11668. hadoop-daemons.sh bw compat broke with --slaves change (Vinayakumar B via aw)

This commit is contained in:
Allen Wittenauer 2015-03-09 22:31:50 -07:00
parent 47f7f18d4c
commit 7711049837
4 changed files with 34 additions and 9 deletions

View File

@ -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)

View File

@ -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[@]}"

View File

@ -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[@]}"
}

View File

@ -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[@]}"