Skip to content

Commit

Permalink
Merge pull request apache#449 from CrazyJvm/master
Browse files Browse the repository at this point in the history
SPARK-1028 : fix "set MASTER automatically fails" bug.

spark-shell intends to set MASTER automatically if we do not provide the option when we start the shell , but there's a problem.
The condition is "if [[ "x" != "x$SPARK_MASTER_IP" && "y" != "y$SPARK_MASTER_PORT" ]];" we sure will set SPARK_MASTER_IP explicitly, the SPARK_MASTER_PORT option, however, we probably do not set just using spark default port 7077. So if we do not set SPARK_MASTER_PORT, the condition will never be true. We should just use default port if users do not set port explicitly I think.
  • Loading branch information
rxin committed Jan 21, 2014
2 parents 0367981 + 8400536 commit 6b4eed7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bin/spark-shell
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@ for o in "$@"; do
done

# Set MASTER from spark-env if possible
DEFAULT_SPARK_MASTER_PORT=7077
if [ -z "$MASTER" ]; then
if [ -e "$FWDIR/conf/spark-env.sh" ]; then
. "$FWDIR/conf/spark-env.sh"
fi
if [[ "x" != "x$SPARK_MASTER_IP" && "y" != "y$SPARK_MASTER_PORT" ]]; then
MASTER="spark://${SPARK_MASTER_IP}:${SPARK_MASTER_PORT}"
export MASTER
if [ "x" != "x$SPARK_MASTER_IP" ]; then
if [ "y" != "y$SPARK_MASTER_PORT" ]; then
SPARK_MASTER_PORT="${SPARK_MASTER_PORT}"
else
SPARK_MASTER_PORT=$DEFAULT_SPARK_MASTER_PORT
fi
export MASTER="spark://${SPARK_MASTER_IP}:${SPARK_MASTER_PORT}"
fi
fi

Expand Down

0 comments on commit 6b4eed7

Please sign in to comment.