HADOOP-10996. Stop violence in the *_HOME (aw)

This commit is contained in:
Allen Wittenauer 2014-08-27 07:00:31 -07:00
parent a1618a2a77
commit 9ec4a930f5
6 changed files with 42 additions and 33 deletions

View File

@ -321,6 +321,8 @@ Trunk (Unreleased)
HADOOP-11002. shell escapes are incompatible with previous releases (aw) HADOOP-11002. shell escapes are incompatible with previous releases (aw)
HADOOP-10996. Stop violence in the *_HOME (aw)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-7761. Improve the performance of raw comparisons. (todd) HADOOP-7761. Improve the performance of raw comparisons. (todd)

View File

@ -53,7 +53,10 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then
fi fi
# get our functions defined for usage later # 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" . "${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh"
else else
echo "ERROR: Unable to exec ${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh." 1>&2 echo "ERROR: Unable to exec ${HADOOP_LIBEXEC_DIR}/hadoop-functions.sh." 1>&2
@ -61,7 +64,10 @@ else
fi fi
# allow overrides of the above and pre-defines of the below # 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" . "${HADOOP_LIBEXEC_DIR}/hadoop-layout.sh"
fi fi

View File

@ -68,17 +68,18 @@ function hadoop_find_confdir
{ {
# NOTE: This function is not user replaceable. # NOTE: This function is not user replaceable.
local conf_dir
# Look for the basic hadoop configuration area. # Look for the basic hadoop configuration area.
# #
# #
# An attempt at compatibility with some Hadoop 1.x # An attempt at compatibility with some Hadoop 1.x
# installs. # installs.
if [[ -e "${HADOOP_PREFIX}/conf/hadoop-env.sh" ]]; then if [[ -e "${HADOOP_PREFIX}/conf/hadoop-env.sh" ]]; then
DEFAULT_CONF_DIR="conf" conf_dir="conf"
else else
DEFAULT_CONF_DIR="etc/hadoop" conf_dir="etc/hadoop"
fi 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 function hadoop_exec_hadoopenv
@ -573,10 +574,7 @@ function hadoop_finalize_hadoop_opts
function hadoop_finalize_classpath function hadoop_finalize_classpath
{ {
hadoop_add_classpath "${HADOOP_CONF_DIR}" before
# 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
# user classpath gets added at the last minute. this allows # user classpath gets added at the last minute. this allows
# override of CONF dirs and more # override of CONF dirs and more

View File

@ -20,7 +20,7 @@
function hadoop_subproject_init 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" . "${HADOOP_CONF_DIR}/hdfs-env.sh"
fi fi
@ -49,7 +49,7 @@ function hadoop_subproject_init
HADOOP_ROOT_LOGGER=${HADOOP_HDFS_ROOT_LOGGER:-$HADOOP_ROOT_LOGGER} HADOOP_ROOT_LOGGER=${HADOOP_HDFS_ROOT_LOGGER:-$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_IDENT_STRING="${HADOOP_HDFS_IDENT_STRING:-$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) HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_hd_this}")" >/dev/null && pwd -P)
fi fi
if [ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]; then if [[ -n "${HADOOP_COMMON_HOME}" ]] &&
. "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
elif [ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]; then
. "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh"
elif [ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]; then elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
. "${HADOOP_HOME}/libexec/hadoop-config.sh" . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then
. "${HADOOP_PREFIX}/libexec/hadoop-config.sh"
else else
echo "ERROR: Hadoop common not found." 2>&1 echo "ERROR: Hadoop common not found." 2>&1
exit 1 exit 1

View File

@ -20,7 +20,7 @@
function hadoop_subproject_init 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" . "${HADOOP_CONF_DIR}/mapred-env.sh"
fi fi
@ -49,7 +49,7 @@ function hadoop_subproject_init
HADOOP_ROOT_LOGGER="${HADOOP_MAPRED_ROOT_LOGGER:-INFO,console}" HADOOP_ROOT_LOGGER="${HADOOP_MAPRED_ROOT_LOGGER:-INFO,console}"
HADOOP_MAPRED_ROOT_LOGGER="${HADOOP_ROOT_LOGGER}" 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_IDENT_STRING="${HADOOP_MAPRED_IDENT_STRING:-$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) HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_mc_this}")" >/dev/null && pwd -P)
fi fi
if [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then if [[ -n "${HADOOP_COMMON_HOME}" ]] &&
. "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
elif [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
. "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh"
elif [[ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]]; then elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
. "${HADOOP_HOME}/libexec/hadoop-config.sh" . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then
. "${HADOOP_PREFIX}/libexec/hadoop-config.sh"
else else
echo "Hadoop common not found." echo "ERROR: Hadoop common not found." 2>&1
exit exit 1
fi fi

View File

@ -80,14 +80,14 @@ if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then
HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_yc_this}")" >/dev/null && pwd -P) HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_yc_this}")" >/dev/null && pwd -P)
fi fi
if [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then if [[ -n "${HADOOP_COMMON_HOME}" ]] &&
. "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
elif [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
. "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh"
elif [[ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]]; then elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
. "${HADOOP_HOME}/libexec/hadoop-config.sh" . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then
. "${HADOOP_PREFIX}/libexec/hadoop-config.sh"
else else
echo "Hadoop common not found." echo "ERROR: Hadoop common not found." 2>&1
exit exit 1
fi fi