This is an automated email from the ASF dual-hosted git repository.

ddanielr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 1b458ff53b9c6deee4af8e9b46d4fe34cbfbcb99
Merge: 2cab146529 ec2f1bd881
Author: Daniel Roberts <ddani...@gmail.com>
AuthorDate: Sun Jul 28 20:17:59 2024 +0000

    Merge branch '2.1'

 assemble/bin/accumulo-cluster                      | 209 ++++++++++++++++++---
 assemble/bin/accumulo-service                      | 138 +++++++++++---
 .../core/conf/cluster/ClusterConfigParser.java     |  16 +-
 .../core/conf/cluster/ClusterConfigParserTest.java |  25 ++-
 .../cluster/cluster-with-optional-services.yaml    |   9 +-
 5 files changed, 322 insertions(+), 75 deletions(-)

diff --cc assemble/bin/accumulo-cluster
index f525093404,bcab27ac66..73350787d6
--- a/assemble/bin/accumulo-cluster
+++ b/assemble/bin/accumulo-cluster
@@@ -194,9 -294,11 +286,11 @@@ function start_all() 
    done
  
    for group in $SSERVER_GROUPS; do
+     var_name="NUM_SSERVERS_${group}"
+     [[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
      G="SSERVER_HOSTS_${group}"
      for sserver in ${!G}; do
 -      start_service "$sserver" sserver "-g" "$group"
 +      start_service "$sserver" sserver "-o" "sserver.group=$group"
      done
    done
  
@@@ -205,9 -307,11 +299,11 @@@
    done
  
    for queue in $COMPACTION_QUEUES; do
+     var_name="NUM_COMPACTORS_${queue}"
+     [[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
      Q="COMPACTOR_HOSTS_${queue}"
      for compactor in ${!Q}; do
 -      start_service "$compactor" compactor "-q" "$queue"
 +      start_service "$compactor" compactor "-o" "compactor.queue=$queue"
      done
    done
  
@@@ -331,9 -439,11 +431,11 @@@ function kill_all() 
    done
  
    for group in $SSERVER_GROUPS; do
+     var_name="NUM_SSERVERS_${group}"
+     [[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
      G="SSERVER_HOSTS_${group}"
      for sserver in ${!G}; do
 -      kill_service "$sserver" sserver "-g" "$group"
 +      kill_service "$sserver" sserver "-o" "sserver.group=$group"
      done
    done
  
@@@ -346,9 -456,11 +448,11 @@@
    done
  
    for queue in $COMPACTION_QUEUES; do
+     var_name="NUM_COMPACTORS_${queue}"
+     [[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
      Q="COMPACTOR_HOSTS_${queue}"
      for compactor in ${!Q}; do
 -      kill_service "$compactor" compactor "-q" "$queue"
 +      kill_service "$compactor" compactor "-o" "compactor.queue=$queue"
      done
    done
  
@@@ -387,9 -499,11 +491,11 @@@ function stop_all() 
      done
  
      for group in $SSERVER_GROUPS; do
+       var_name="NUM_SSERVERS_${group}"
+       [[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
        G="SSERVER_HOSTS_${group}"
        for sserver in ${!G}; do
 -        end_service $end_cmd "$sserver" sserver "-g" "$group"
 +        end_service $end_cmd "$sserver" sserver "-o" "sserver.group=$group"
        done
      done
  
@@@ -398,9 -512,11 +504,11 @@@
      done
  
      for queue in $COMPACTION_QUEUES; do
+       var_name="NUM_COMPACTORS_${queue}"
+       [[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
        Q="COMPACTOR_HOSTS_${queue}"
        for compactor in ${!Q}; do
 -        end_service $end_cmd "$compactor" compactor "-q" "$queue"
 +        end_service $end_cmd "$compactor" compactor "-o" 
"compactor.queue=$queue"
        done
      done
  
@@@ -435,15 -551,19 +543,19 @@@ function stop_here() 
          end_service $end_cmd "$host" $svc
        done
        for group in $SSERVER_GROUPS; do
+         var_name="NUM_SSERVERS_${group}"
+         [[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
          G="SSERVER_HOSTS_${group}"
          for sserver in ${!G}; do
 -          end_service $end_cmd "$sserver" sserver "-g" "$group"
 +          end_service $end_cmd "$sserver" sserver "-o" "sserver.group=$group"
          done
        done
        for queue in $COMPACTION_QUEUES; do
+         var_name="NUM_COMPACTORS_${queue}"
+         [[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
          Q="COMPACTOR_HOSTS_${queue}"
          for compactor in ${!Q}; do
 -          end_service $end_cmd "$host" compactor "-q" "$queue"
 +          end_service $end_cmd "$host" compactor "-o" "compactor.queue=$queue"
          done
        done
      done
diff --cc assemble/bin/accumulo-service
index c501876043,6d7edb5283..9da187135d
--- a/assemble/bin/accumulo-service
+++ b/assemble/bin/accumulo-service
@@@ -136,30 -192,56 +191,51 @@@ function main() 
    mkdir -p "$ACCUMULO_LOG_DIR" 2>/dev/null
    mkdir -p "$ACCUMULO_PID_DIR" 2>/dev/null
  
-   host="$(hostname)"
-   if [[ -z $host ]]; then
-     host=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut 
-f1 -d'/')
+   HOST="$(hostname)"
+   if [[ -z $HOST ]]; then
+     HOST=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut 
-f1 -d'/')
    fi
-   service="$1"
  
-   
pid_file="${ACCUMULO_PID_DIR}/accumulo-${service}${ACCUMULO_SERVICE_INSTANCE}.pid"
-   case "$service" in
+   local service_type="$1"
+   local command_name="$2"
+   shift 2
+   local service_name="unknown"
+   local all_flag=false
+ 
 -  if [[ $service_type == "master" ]]; then
 -    echo "WARN : Use of 'master' service name is deprecated; use 'manager' 
instead."
 -    service_type="manager"
 -  fi
 -
+   # Check and see if accumulo-cluster is calling this script
+   if [[ -z $ACCUMULO_SERVICE_INSTANCE ]]; then
+     # The rest of the arguments are from a user
+     if [[ $1 == "--all" ]]; then
+       all_flag=true
+     else
+       # A named service has been specified
+       service_name="$1"
+     fi
+   # Use the special bash env var from accumulo-cluster
+   else
+     service_name=${service_type}${ACCUMULO_SERVICE_INSTANCE}
+   fi
+ 
+   case "$service_type" in
      gc | manager | monitor | tserver | compaction-coordinator | compactor | 
sserver)
-       if [[ -z $2 ]]; then
+       if [[ -z $command_name ]]; then
          invalid_args "<command> cannot be empty"
        fi
-       case "$2" in
+       case "$command_name" in
          start)
-           start_service "${@:3}"
+           start_service "$service_type" "$service_name" "$@"
            ;;
          stop)
-           stop_service
+           stop_service "$service_type" "$service_name" $all_flag
            ;;
          kill)
-           kill_service
+           kill_service "$service_type" "$service_name" $all_flag
+           ;;
+         list)
+           list_processes "$service_type"
            ;;
          *)
-           invalid_args "'$2' is an invalid <command>"
+           invalid_args "'$command_name' is an invalid <command>"
            ;;
        esac
        ;;

Reply via email to