Kai Zheng created HADOOP-9873: --------------------------------- Summary: hadoop-env.sh got called multiple times Key: HADOOP-9873 URL: https://issues.apache.org/jira/browse/HADOOP-9873 Project: Hadoop Common Issue Type: Bug Components: scripts Reporter: Kai Zheng Assignee: Kai Zheng Priority: Minor
Ref. below, it can be seen hadoop-env.sh got called multiple times when running something like 'hadoop-daemon.sh start namenode'. {noformat} [drankye@zkdev ~]$ cd $HADOOP_PREFIX [drankye@zkdev hadoop-3.0.0-SNAPSHOT]$ grep -r hadoop-env * libexec/hadoop-config.sh:if [ -e "${HADOOP_PREFIX}/conf/hadoop-env.sh" ]; then libexec/hadoop-config.sh:if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then libexec/hadoop-config.sh: . "${HADOOP_CONF_DIR}/hadoop-env.sh" sbin/hadoop-daemon.sh:if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then sbin/hadoop-daemon.sh: . "${HADOOP_CONF_DIR}/hadoop-env.sh" {noformat} Considering the following lines in hadoop-env.sh {code} # Command specific options appended to HADOOP_OPTS when specified export HADOOP_NAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_NAMENODE_OPTS" {code} It may end with some redundant result like below when called multiple times. {noformat} HADOOP_NAMENODE_OPTS='-Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender ' {noformat} It's not a big issue for now however it would be better to be clean and avoid this since it can cause the final JAVA command line is very lengthy and hard to read. A possible fix would be to add a flag variable like HADOOP_ENV_INITED in hadoop-env.sh, and then at the beginning of it check the flag. If the flag evaluates true, then return immediately. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira