You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by la...@apache.org on 2021/06/03 09:48:58 UTC

[incubator-pegasus] 01/06: fix(script): oprimizations for pegasus_rolling_update.sh (#708)

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

laiyingchun pushed a commit to branch v2.2
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git

commit 5327d8cbc96826695fcd43f88f227e85c70c901e
Author: Zhang Yifan <ch...@163.com>
AuthorDate: Wed Apr 28 16:38:47 2021 +0800

    fix(script): oprimizations for pegasus_rolling_update.sh (#708)
---
 scripts/pegasus_rolling_update.sh | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/scripts/pegasus_rolling_update.sh b/scripts/pegasus_rolling_update.sh
index ecb6002..cb86f9f 100755
--- a/scripts/pegasus_rolling_update.sh
+++ b/scripts/pegasus_rolling_update.sh
@@ -22,7 +22,8 @@
 PID=$$
 
 if [ $# -le 3 ]; then
-  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <type> <start_task_id>"
+  echo "USAGE: $0 <cluster-name> <cluster-meta-list> <type> <start_task_id> "
+       "<rebalance_cluster_after_rolling>(default false) <rebalance_only_move_primary>(default true)"
   echo
   echo "The type may be 'one' or 'all':"
   echo "  - one: rolling update only one task of replica server."
@@ -48,6 +49,18 @@ if [ "$type" != "one" -a "$type" != "all" ]; then
   exit 1
 fi
 
+if [ -z $5 ]; then
+  rebalance_cluster_after_rolling=false
+else
+  rebalance_cluster_after_rolling=$5
+fi
+
+if [ -z $6 ]; then
+  rebalance_only_move_primary=true
+else
+  rebalance_only_move_primary=$6
+fi
+
 pwd="$( cd "$( dirname "$0"  )" && pwd )"
 shell_dir="$( cd $pwd/.. && pwd )"
 cd $shell_dir
@@ -222,14 +235,6 @@ do
 
   echo "remote_command -l $node flush-log" | ./run.sh shell --cluster $meta_list &>/dev/null
 
-  echo "Set lb.add_secondary_max_count_for_one_node to 100..."
-  echo "remote_command -l $pmeta meta.lb.add_secondary_max_count_for_one_node 100" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node
-  set_ok=`grep OK /tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node | wc -l`
-  if [ $set_ok -ne 1 ]; then
-    echo "ERROR: set lb.add_secondary_max_count_for_one_node to 100 failed"
-    exit 1
-  fi
-
   echo "Rolling update by minos..."
   minos_rolling_update $cluster replica $task_id
   echo "Rolling update by minos done."
@@ -250,6 +255,14 @@ do
   echo
   sleep 1
 
+  echo "Set lb.add_secondary_max_count_for_one_node to 100..."
+  echo "remote_command -l $pmeta meta.lb.add_secondary_max_count_for_one_node 100" | ./run.sh shell --cluster $meta_list &>/tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node
+  set_ok=`grep OK /tmp/$UID.$PID.pegasus.rolling_update.add_secondary_max_count_for_one_node | wc -l`
+  if [ $set_ok -ne 1 ]; then
+    echo "ERROR: set lb.add_secondary_max_count_for_one_node to 100 failed"
+    exit 1
+  fi
+
   echo "Wait cluster to become healthy..."
   while true
   do
@@ -294,8 +307,11 @@ if [ "$type" = "all" ]; then
   minos_rolling_update $cluster collector
   echo "Rolling update collectors done."
   echo
+fi
 
-  ./scripts/pegasus_rebalance_cluster.sh $cluster $meta_list
+if [ "$rebalance_cluster_after_rolling" == "true" ]; then
+  echo "Start to rebalance cluster..."
+  ./scripts/pegasus_rebalance_cluster.sh $cluster $meta_list $rebalance_only_move_primary
 fi
 
 echo "Finish time: `date`"

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org