accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] accumulo pull request: ACCUMULO-4162 Fix zookeeper version matchin...
Date Mon, 21 Mar 2016 17:31:51 GMT
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.
---

Mime
View raw message