dlmarion commented on a change in pull request #2238:
URL: https://github.com/apache/accumulo/pull/2238#discussion_r700366616



##########
File path: assemble/bin/accumulo-cluster
##########
@@ -147,84 +164,128 @@ function start_all() {
     start_tservers
   fi
 
-  grep -Ev '(^#|^\s*$)' "${conf}/$manager_file" | while read -r host; do
-    start_service "$host" manager
+  for manager in $MANAGER_HOSTS; do
+    start_service "$manager" manager
+  done
+
+  for gc in $GC_HOSTS; do
+    start_service "$gc" gc
   done
 
-  grep -Ev '(^#|^\s*$)' "${conf}/gc" | while read -r host; do
-    start_service "$host" gc
+  for monitor in $MONITOR_HOSTS; do
+    start_service "$monitor" monitor
   done
 
-  grep -Ev '(^#|^\s*$)' "${conf}/tracers" | while read -r host; do
-    start_service "$host" tracer
+  for tracer in $TRACER_HOSTS; do
+    start_service "$tracer" tracer
+  done
+
+  for coordinator in $COORDINATOR_HOSTS; do
+    start_service "$coordinator" compaction-coordinator
+  done
+
+  for queue in $COMPACTION_QUEUES; do
+    Q="COMPACTOR_HOSTS_${queue}"
+    for compactor in "${!Q}"; do
+      start_service "$compactor" compactor "-q" "$queue"
+    done
   done
 
-  start_service "$monitor" monitor
 }
 
 function start_here() {
 
   local_hosts="$(hostname -a 2> /dev/null) $(hostname) localhost 127.0.0.1 
$(get_ip)"
+
   for host in $local_hosts; do
-    if grep -q "^${host}\$" "${conf}/tservers"; then
-      start_service "$host" tserver
-      break
-    fi
+    for tserver in $TSERVER_HOSTS; do
+      if echo "$tserver" | grep -q "^${host}\$"; then
+        start_service "$host" tserver
+        break
+      fi
+    done
   done
 
   for host in $local_hosts; do
-    if grep -q "^${host}\$" "${conf}/$manager_file"; then
-      start_service "$host" manager
-      break
-    fi
+    for manager in $MANAGER_HOSTS; do
+      if echo "$manager" | grep -q "^${host}\$"; then
+        start_service "$host" manager
+        break
+      fi
+    done
   done
 
   for host in $local_hosts; do
-    if grep -q "^${host}\$" "${conf}/gc"; then
-      start_service "$host" gc
-      break
-    fi
+    for gc in $GC_HOSTS; do
+      if echo "$gc" | grep -q "^${host}\$"; then
+        start_service "$host" gc
+        break
+      fi
+    done
   done
 
   for host in $local_hosts; do
-    if [[ "$host" == "$monitor" ]]; then
-      start_service "$host" monitor
-      break
-    fi
+    for monitor in $MONITOR_HOSTS; do
+      if echo "$monitor" | grep -q "^${host}\$"; then
+        start_service "$host" monitor
+        break
+      fi
+    done
   done
 
   for host in $local_hosts; do
-    if grep -q "^${host}\$" "${conf}/tracers"; then
-      start_service "$host" tracer
-      break
-    fi
+    for tracer in $TRACER_HOSTS; do
+      if echo "$tracer" | grep -q "^${host}\$"; then
+        start_service "$host" tracer
+        break
+      fi
+    done
   done
+
+  for host in $local_hosts; do
+    for coordinator in $COORDINATOR_HOSTS; do
+      if echo "$coordinator" | grep -q "^${host}\$"; then
+        start_service "$coordinator" compaction-coordinator
+      fi
+    done
+  done
+
+  for queue in $COMPACTION_QUEUES; do
+    for host in $local_hosts; do
+      Q="COMPACTOR_HOSTS_${queue}"
+      for compactor in "${!Q}"; do

Review comment:
       So, IIRC, `"${Q}"` would resolve to `"${COMPACTOR_HOSTS_q1}"`, but for 
some reason `bash` did not find the value of that (even though it's in the 
variables in `$CONFIG_FILE`. Using `"${!Q}"` performs a level of indirection. 
From the `bash` man page:
   
   ```
   ${parameter}
    The value of parameter is substituted.  The braces are required when 
parameter is a positional parameter with more than one digit,  or when 
parameter is followed by a character which is not to be interpreted as part of 
its name.
   
     If  the  first character of parameter is an exclamation point (!), a level 
of variable indirection is introduced. 
    Bash uses the value of the variable formed from the rest of parameter as 
the name of the variable; this 
    variable is then expanded and that value is used in the rest  of the 
substitution, rather than the value of parameter itself.  This is known as 
indirect expansion.  The exceptions to this are the expansions of ${!prefix*} 
and ${!name[@]} described below.  The exclamation point must immediately follow 
the left brace in order to introduce  indirection.
   ```




-- 
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