You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by ctubbsii <gi...@git.apache.org> on 2016/03/17 05:11:38 UTC

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

GitHub user ctubbsii opened a pull request:

    https://github.com/apache/accumulo/pull/81

    ACCUMULO-4162 Fix zookeeper version matching

    In the course of fixing ACCUMULO-4162, I noticed lots of other small script problems which were just as likely to mess up users. So, I ran shellcheck on all the scripts in assemble/bin, and a little bit outside there. This is the results for the 1.6 branch, and could use a bit of a review/manual testing to make sure they work as expected.
    
    Any help checking these out would be greatly appreciated.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ctubbsii/accumulo shellcheck-pedantry

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/accumulo/pull/81.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #81
    
----
commit 0e5657945de3494f6790284f13044bff5db4aa57
Author: Christopher Tubbs <ct...@apache.org>
Date:   2016-03-17T04:04:20Z

    ACCUMULO-4162 Fix zookeeper version matching
    
    Apply many shellcheck fixes

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on the pull request:

    https://github.com/apache/accumulo/pull/81#issuecomment-201059061
  
    I'm going to close this for now, in favor of a more conservative change to fix the issue in ACCUMULO-4162. I may reconsider applying these changes in the master branch at a future point.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56754529
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    +    "${bin}/start-server.sh" "$host" "${otherArgs[@]}"
    +  done < <(egrep -v '^(\s*#.*|\s*)$' "$ACCUMULO_CONF_DIR/$hostfile")
    --- End diff --
    
    The egrep pattern is slightly different here. Any chance for a comment? :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56862478
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    +    "${bin}/start-server.sh" "$host" "${otherArgs[@]}"
    +  done < <(egrep -v '^(\s*#.*|\s*)$' "$ACCUMULO_CONF_DIR/$hostfile")
    --- End diff --
    
    However you think is most explicit/concise in grep syntax is fine. I'd just ask for a human readable comment there as well :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii closed the pull request at:

    https://github.com/apache/accumulo/pull/81


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56862654
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    --- End diff --
    
    Makes sense! That has bitten me before.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56862234
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    +    "${bin}/start-server.sh" "$host" "${otherArgs[@]}"
    +  done < <(egrep -v '^(\s*#.*|\s*)$' "$ACCUMULO_CONF_DIR/$hostfile")
    --- End diff --
    
    I just thought this version was a bit more explicit. (It's also tolerant of indented comment lines.)
    Read as: lines either beginning by any amount of whitespace followed by a comment OR any amount of whitespace before termination
    
    Another variation, which might be more readable is: '^\s*(#.*)?$'
    Read as: lines starting with any amount of whitespace, optionally followed by a comment, before termination


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56862425
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    --- End diff --
    
    Yes. This is the default behavior of IFS, but I wanted to be explicit, and didn't want to have user's exported IFS interfere.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/81#discussion_r56754512
  
    --- Diff: assemble/bin/start-all.sh ---
    @@ -28,50 +28,52 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
     . "$bin"/config.sh
     unset DISPLAY
     
    -if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
    +if [[ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
        echo "${ACCUMULO_CONF_DIR}/accumulo-env.sh does not exist. Please make sure you configure Accumulo before you run anything"
        echo "We provide examples you can copy in ${ACCUMULO_HOME}/conf/examples/ which are set up for your memory footprint"
        exit 1
     fi
     
    -if [ -z "$ZOOKEEPER_HOME" ] ; then
    +if [[ -z "$ZOOKEEPER_HOME" ]] ; then
        echo "ZOOKEEPER_HOME is not set.  Please make sure it's set globally or in conf/accumulo-env.sh"
        exit 1
     fi
    -if [ ! -d $ZOOKEEPER_HOME ]; then
    +if [[ ! -d $ZOOKEEPER_HOME ]]; then
        echo "ZOOKEEPER_HOME is not a directory: $ZOOKEEPER_HOME"
        echo "Please check the setting, either globally or in accumulo-env.sh."
        exit 1
     fi
     
    -ZOOKEEPER_VERSION=$(find -L $ZOOKEEPER_HOME -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    -if [ -z "$ZOOKEEPER_VERSION" ]; then
    +ZOOKEEPER_VERSION=$(find -L "$ZOOKEEPER_HOME" -maxdepth 1 -name "zookeeper-[0-9]*.jar" | head -1)
    +if [[ -z "$ZOOKEEPER_VERSION" ]]; then
        echo "A Zookeeper JAR was not found in $ZOOKEEPER_HOME."
        echo "Please check ZOOKEEPER_HOME, either globally or in accumulo-env.sh."
        exit 1
     fi
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION##$ZOOKEEPER_HOME/zookeeper-}
    -ZOOKEEPER_VERSION=${ZOOKEEPER_VERSION%%.jar}
    +ZOOKEEPER_VERSION=$(basename "${ZOOKEEPER_VERSION##*-}" .jar)
     
    -if [ "$ZOOKEEPER_VERSION" '<' "3.3.0" ]; then
    +if [[ "$ZOOKEEPER_VERSION" < "3.3.0" ]]; then
        echo "WARN : Using Zookeeper $ZOOKEEPER_VERSION.  Use version 3.3.0 or greater to avoid zookeeper deadlock bug.";
     fi
     
    -${bin}/start-server.sh $MONITOR monitor 
    +"${bin}/start-server.sh" "$MONITOR" monitor
     
    -if [ "$1" != "--notSlaves" ]; then
    -   ${bin}/tup.sh
    +if [[ "$1" != "--notSlaves" ]]; then
    +   "${bin}/tup.sh"
     fi
     
    -${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
    -for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
    -   ${bin}/start-server.sh $master master
    -done
    +"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
     
    -for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
    -   ${bin}/start-server.sh $gc gc "garbage collector"
    -done
    +startServersFromHostsFile() {
    +  # use hostfile in conf dir to get hosts, and start each server with the remaining args
    +  local hostfile; hostfile="$1"
    +  shift
    +  local otherArgs; otherArgs=("$@")
    +  while IFS=$' \t\n' read -r host; do
    --- End diff --
    
    IFS=$' \t\n' is splitting on space, tab and newline?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---