ctubbsii commented on code in PR #5174:
URL: https://github.com/apache/accumulo/pull/5174#discussion_r1887308162


##########
assemble/bin/accumulo-cluster:
##########
@@ -27,598 +35,517 @@ Options:
 
 Commands:
   create-config              Creates cluster config
-  restart                    Restarts the Accumulo cluster
-  start                      Starts Accumulo cluster
-  stop                       Stops Accumulo cluster
-  kill                       Kills Accumulo cluster
-  start-non-tservers         Deprecated. Starts all services except tservers
-  start-servers [--all|--tservers|--no-tservers|--sservers 
[group]|--compactors [queue]]
-                             Starts various server types, can optionally 
specify a queue or group
-  stop-servers [--all|--tservers| --no-tservers|--sservers 
[group]|--compactors [queue]]
-                             Starts various server types, can optionally 
specify a queue or group
-  start-tservers             Deprecated. Starts all tservers on cluster
-  stop-tservers              Deprecated. Stops all tservers on cluster
-  start-here                 Starts all services on this node
-  stop-here                  Stops all services on this node
+  start-non-tservers         Deprecated. Alias for "start --manager --gc 
--monitor --compaction-coordinator --sservers --compactors"
+  start-servers              Deprecated. Alias for "start"
+  stop-servers               Deprecated. Alias for "stop"
+  start-tservers             Deprecated. Alias for "start --tservers"
+  stop-tservers              Deprecated. Alias for "stop --tservers"
+  start-here                 Deprecated. Alias for "start --local --all"
+  stop-here                  Deprecated. Alias for "stop --local --all"
+  restart [--local] [--all | [--manager] [--gc] [--monitor] 
[--compaction-coordinator] [--tservers] [--sservers[=group]] 
[--compactors[=group]]
+                             Restarts Accumulo cluster services
+  start [--local] [--all | [--manager] [--gc] [--monitor] 
[--compaction-coordinator] [--tservers] [--sservers[=group]] 
[--compactors[=group]]
+                             Starts Accumulo cluster services
+  stop [--local] [--all | [--manager] [--gc] [--monitor] 
[--compaction-coordinator] [--tservers] [--sservers[=group]] 
[--compactors[=group]]
+                             Stops Accumulo cluster services
+  kill [--local] [--all | [--manager] [--gc] [--monitor] 
[--compaction-coordinator] [--tservers] [--sservers[=group]] 
[--compactors[=group]]
+                             Kills Accumulo cluster services
+
+  Examples:
+
+  accumulo-cluster start                                   # start all servers
+  accumulo-cluster start --dry-run                         # print debug 
information and commands to be executed
+  accumulo-cluster start --local                           # start all local 
services
+  accumulo-cluster start --local --manager                 # start local 
manager services
+  accumulo-cluster start --tservers                        # start all tservers
+  accumulo-cluster start --sservers=group1                 # start all group1 
sservers
+  accumulo-cluster start --local --manager --tservers      # Start the local 
manager and local tservers
+
 EOF
 }
 
+function parse_args {
+  DEBUG=0
+  ARG_LOCAL=0
+  ARG_ALL=0
+  ARG_MANAGER=0
+  ARG_GC=0
+  ARG_MONITOR=0
+  ARG_COORDINATOR=0
+  ARG_TSERVER=0
+  ARG_TSERVER_GROUP=""
+  ARG_SSERVER=0
+  ARG_SSERVER_GROUP=""
+  ARG_COMPACTOR=0
+  ARG_COMPACTOR_GROUP=""
+
+  PARSE_OUTPUT=$(getopt -o "" --long 
"dry-run,all,local,manager,gc,monitor,compaction-coordinator,no-tservers,tservers,sservers::,compactors::"
 -n 'accumulo-cluster' -- "$@")
+  eval set -- "$PARSE_OUTPUT"
+
+  while true; do
+    case "$1" in
+      --dry-run)
+        DEBUG=1
+        debug "args: $PARSE_OUTPUT"
+        shift 1
+        ;;
+      --all)
+        ARG_ALL=1
+        shift 1
+        ;;
+      --local)
+        ARG_LOCAL=1
+        shift 1
+        ;;
+      --manager)
+        ARG_MANAGER=1
+        shift 1
+        ;;
+      --gc)
+        ARG_GC=1
+        shift 1
+        ;;
+      --monitor)
+        ARG_MONITOR=1
+        shift 1
+        ;;
+      --compaction-coordinator)
+        ARG_COORDINATOR=1
+        shift 1
+        ;;
+      --no-tservers)
+        echo -- "--no-tservers is deprecated. Please specify the servers you 
wish to manage instead"
+        ARG_MANAGER=1
+        ARG_GC=1
+        ARG_MONITOR=1
+        ARG_COORDINATOR=1
+        ARG_SSERVER=1
+        ARG_COMPACTOR=1
+        shift 1
+        ;;
+      --tservers)
+        ARG_TSERVER=1
+        shift 1
+        ;;
+      --sservers)
+        ARG_SSERVER=1
+        if [[ -n $2 ]]; then
+          ARG_SSERVER_GROUP=$2
+        fi
+        shift 2
+        ;;
+      --compactors)
+        ARG_COMPACTOR=1
+        if [[ -n $2 ]]; then
+          ARG_COMPACTOR_GROUP=$2
+        fi
+        shift 2
+        ;;
+      --)
+        shift
+        break
+        ;;
+      *)
+        echo "Unhandled option: $1"
+        print_usage
+        exit 1
+        ;;
+    esac
+  done
+
+  # All and any of the others are mutually exclusive
+  if [[ $ARG_ALL == 1 && ($ARG_MANAGER == 1 ||
+    $ARG_GC == 1 || $ARG_MONITOR == 1 || $ARG_COORDINATOR == 1 || $ARG_TSERVER 
== 1 ||
+    $ARG_SSERVER == 1 || $ARG_COMPACTOR == 1) ]]; then
+    echo -- "--all cannot be used with other options"
+    print_usage
+    exit 1
+  fi
+
+  # Handle the case where no args were passed
+  if [[ $ARG_MANAGER == 0 && $ARG_GC == 0 &&
+    $ARG_MONITOR == 0 && $ARG_COORDINATOR == 0 && $ARG_TSERVER == 0 &&
+    $ARG_SSERVER == 0 && $ARG_COMPACTOR == 0 ]]; then
+    ARG_ALL=1
+  fi
+
+  debug "ARG_ALL=$ARG_ALL"
+  debug "ARG_LOCAL=$ARG_LOCAL"
+  debug "ARG_MANAGER=$ARG_MANAGER"
+  debug "ARG_GC=$ARG_GC"
+  debug "ARG_MONITOR=$ARG_MONITOR"
+  debug "ARG_COORDINATOR=$ARG_COORDINATOR"
+  debug "ARG_TSERVER=$ARG_TSERVER"
+  debug "ARG_TSERVER_GROUP=$ARG_TSERVER_GROUP"

Review Comment:
   That's why it's never set when getopt options are parsed. It remains empty. 
This is just script internals to keep it aligned with what's in the main 
branch. It doesn't mean tserver groups are supported.
   
   If you're looking at these changes by comparing with what's in 2.1, I 
suggest instead comparing it to what's in main. It's a much smaller diff, and 
makes a lot more sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to