diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 2270df3424..45e38d392f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -321,6 +321,8 @@ Trunk (Unreleased) HADOOP-11002. shell escapes are incompatible with previous releases (aw) + HADOOP-10996. Stop violence in the *_HOME (aw) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh index b2fc4d341d..0cf8bcfc78 100644 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh @@ -53,7 +53,10 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then fi # get our functions defined for usage later -if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh" ]]; then +if [[ -n "${HADOOP_COMMON_HOME}" ]] && + [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-functions.sh" ]]; then + . "${HADOOP_COMMON_HOME}/libexec/hadoop-functions.sh" +elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh" ]]; then . "${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh" else echo "ERROR: Unable to exec ${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh." 1>&2 @@ -61,7 +64,10 @@ else fi # allow overrides of the above and pre-defines of the below -if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-layout.sh" ]]; then +if [[ -n "${HADOOP_COMMON_HOME}" ]] && + [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-layout.sh" ]]; then + . "${HADOOP_COMMON_HOME}/libexec/hadoop-layout.sh" +elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-layout.sh" ]]; then . "${HADOOP_LIBEXEC_DIR}/hadoop-layout.sh" fi 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 ab61b8483f..800e024485 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 @@ -68,17 +68,18 @@ function hadoop_find_confdir { # NOTE: This function is not user replaceable. + local conf_dir # Look for the basic hadoop configuration area. # # # An attempt at compatibility with some Hadoop 1.x # installs. if [[ -e "${HADOOP_PREFIX}/conf/hadoop-env.sh" ]]; then - DEFAULT_CONF_DIR="conf" + conf_dir="conf" else - DEFAULT_CONF_DIR="etc/hadoop" + conf_dir="etc/hadoop" fi - export HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-${HADOOP_PREFIX}/${DEFAULT_CONF_DIR}}" + export HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-${HADOOP_PREFIX}/${conf_dir}}" } function hadoop_exec_hadoopenv @@ -573,10 +574,7 @@ function hadoop_finalize_hadoop_opts function hadoop_finalize_classpath { - - # we want the HADOOP_CONF_DIR at the end - # according to oom, it gives a 2% perf boost - hadoop_add_classpath "${HADOOP_CONF_DIR}" after + hadoop_add_classpath "${HADOOP_CONF_DIR}" before # user classpath gets added at the last minute. this allows # override of CONF dirs and more diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs-config.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs-config.sh index fb460d96d6..68240287d9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs-config.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs-config.sh @@ -20,7 +20,7 @@ function hadoop_subproject_init { - if [ -e "${HADOOP_CONF_DIR}/hdfs-env.sh" ]; then + if [[ -e "${HADOOP_CONF_DIR}/hdfs-env.sh" ]]; then . "${HADOOP_CONF_DIR}/hdfs-env.sh" fi @@ -49,7 +49,7 @@ function hadoop_subproject_init HADOOP_ROOT_LOGGER=${HADOOP_HDFS_ROOT_LOGGER:-$HADOOP_ROOT_LOGGER} HADOOP_HDFS_ROOT_LOGGER="${HADOOP_ROOT_LOGGER}" - HADOOP_HDFS_HOME="${HADOOP_HDFS_HOME:-$HADOOP_HOME_DIR}" + HADOOP_HDFS_HOME="${HADOOP_HDFS_HOME:-$HADOOP_PREFIX}" HADOOP_IDENT_STRING="${HADOOP_HDFS_IDENT_STRING:-$HADOOP_IDENT_STRING}" HADOOP_HDFS_IDENT_STRING="${HADOOP_IDENT_STRING}" @@ -71,12 +71,13 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_hd_this}")" >/dev/null && pwd -P) fi -if [ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]; then - . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" -elif [ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]; then +if [[ -n "${HADOOP_COMMON_HOME}" ]] && + [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" -elif [ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]; then - . "${HADOOP_HOME}/libexec/hadoop-config.sh" +elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then + . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" +elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then + . "${HADOOP_PREFIX}/libexec/hadoop-config.sh" else echo "ERROR: Hadoop common not found." 2>&1 exit 1 diff --git a/hadoop-mapreduce-project/bin/mapred-config.sh b/hadoop-mapreduce-project/bin/mapred-config.sh index c24d3509c4..c2681ac66b 100644 --- a/hadoop-mapreduce-project/bin/mapred-config.sh +++ b/hadoop-mapreduce-project/bin/mapred-config.sh @@ -20,7 +20,7 @@ function hadoop_subproject_init { - if [ -e "${HADOOP_CONF_DIR}/mapred-env.sh" ]; then + if [[ -e "${HADOOP_CONF_DIR}/mapred-env.sh" ]]; then . "${HADOOP_CONF_DIR}/mapred-env.sh" fi @@ -49,7 +49,7 @@ function hadoop_subproject_init HADOOP_ROOT_LOGGER="${HADOOP_MAPRED_ROOT_LOGGER:-INFO,console}" HADOOP_MAPRED_ROOT_LOGGER="${HADOOP_ROOT_LOGGER}" - HADOOP_MAPRED_HOME="${HADOOP_MAPRED_HOME:-$HADOOP_HOME_DIR}" + HADOOP_MAPRED_HOME="${HADOOP_MAPRED_HOME:-$HADOOP_PREFIX}" HADOOP_IDENT_STRING="${HADOOP_MAPRED_IDENT_STRING:-$HADOOP_IDENT_STRING}" HADOOP_MAPRED_IDENT_STRING="${HADOOP_IDENT_STRING}" @@ -60,13 +60,15 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_mc_this}")" >/dev/null && pwd -P) fi -if [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then - . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" -elif [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then +if [[ -n "${HADOOP_COMMON_HOME}" ]] && + [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" -elif [[ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]]; then - . "${HADOOP_HOME}/libexec/hadoop-config.sh" +elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then + . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" +elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then + . "${HADOOP_PREFIX}/libexec/hadoop-config.sh" else - echo "Hadoop common not found." - exit + echo "ERROR: Hadoop common not found." 2>&1 + exit 1 fi + diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn-config.sh b/hadoop-yarn-project/hadoop-yarn/bin/yarn-config.sh index 34d2d2d0a8..d83e9983d4 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn-config.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn-config.sh @@ -80,14 +80,14 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_yc_this}")" >/dev/null && pwd -P) fi -if [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then - . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" -elif [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then +if [[ -n "${HADOOP_COMMON_HOME}" ]] && + [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" -elif [[ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]]; then - . "${HADOOP_HOME}/libexec/hadoop-config.sh" +elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then + . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" +elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then + . "${HADOOP_PREFIX}/libexec/hadoop-config.sh" else - echo "Hadoop common not found." - exit + echo "ERROR: Hadoop common not found." 2>&1 + exit 1 fi -