You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dl...@apache.org on 2022/10/19 15:45:29 UTC

[accumulo-testing] branch main updated: Enable agitator to work with multiple hosts when max_kill equals 1 (#249)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new b180294  Enable agitator to work with multiple hosts when max_kill equals 1 (#249)
b180294 is described below

commit b18029427cbc1ea0fa0c3c7403cb6fe5e203f0b3
Author: Dave Marion <dl...@apache.org>
AuthorDate: Wed Oct 19 11:45:24 2022 -0400

    Enable agitator to work with multiple hosts when max_kill equals 1 (#249)
    
    Fixes issue in agitator where max_kill is set to 1 and there are
    multiple hosts, but the agitator only starts/stops services on the
    first host in the array
    
    Closes #248
---
 bin/agitator | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bin/agitator b/bin/agitator
index 23d2bbd..a4fbe97 100755
--- a/bin/agitator
+++ b/bin/agitator
@@ -73,7 +73,7 @@ function start_app_agitator() {
     sleep $((kill_sleep_time * 60))
 
     T="$(date +'%Y%m%d %H:%M:%S')"
-    if ((max_kill == 1)); then
+    if ((num_hosts == 1)); then
       node_to_kill=${hosts_array[0]}
       echo "$T Killing $app_name at $node_to_kill"
       ssh "$node_to_kill" "$kill_cmd"
@@ -82,7 +82,7 @@ function start_app_agitator() {
       # get the random nodes to kill
       local count=0
       while [[ $count -lt $num_to_kill ]]; do
-        randomHostIndex=$((1 + RANDOM % num_hosts))
+        randomHostIndex=$((RANDOM % num_hosts))
         node_to_kill=${hosts_array[randomHostIndex]}
         # only add host to the array if its not already there
         if [[ ! " ${nodes_to_kill_array[*]} " =~ $node_to_kill ]]; then
@@ -92,6 +92,7 @@ function start_app_agitator() {
       done
       echo "$T Killing $count $app_name nodes"
       for i in "${nodes_to_kill_array[@]}"; do
+        echo "$T Killing $app_name at $i"
         ssh "$i" "$kill_cmd"
       done
     fi
@@ -101,7 +102,7 @@ function start_app_agitator() {
     sleep $((restart_sleep_time * 60))
 
     T="$(date +'%Y%m%d %H:%M:%S')"
-    if ((max_kill == 1)); then
+    if ((num_hosts == 1)); then
       echo "$T Restarting $app_name at $node_to_kill"
       ssh "$node_to_kill" "bash -c '${ENV_VARS} $start_cmd'"
     else