acelyc111 commented on code in PR #1370:
URL: 
https://github.com/apache/incubator-pegasus/pull/1370#discussion_r1124150592


##########
run.sh:
##########
@@ -1660,6 +1663,11 @@ function run_migrate_node()
                 CLUSTER="$2"
                 shift
                 ;;
+            -p|--config)
+                CONFIG="$2"
+                CONFIG_SPECIFIED=1

Review Comment:
   `CONFIG_SPECIFIED` can be removed, just judge whether `CONFIG` is empty or 
not?



##########
run.sh:
##########
@@ -1703,14 +1711,22 @@ function run_migrate_node()
         exit 1
     fi
 
-    echo "CLUSTER=$CLUSTER"
+    if [ ${CONFIG_SPECIFIED} -eq 0 ]; then
+        echo "CLUSTER=$CLUSTER"
+    else
+        echo "CONFIG=$CONFIG"
+    fi
     echo "NODE=$NODE"
     echo "APP=$APP"
     echo "TYPE=$TYPE"
     echo
     cd ${ROOT}
     echo "------------------------------"
-    ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE
+    if [ ${CONFIG_SPECIFIED} -eq 0 ]; then
+        ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE
+    else
+       ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE $CONFIG_SPECIFIED

Review Comment:
   Should use `$CONFIG` instead of `$CLUSTER`?



##########
scripts/migrate_node.sh:
##########
@@ -20,37 +20,52 @@ set -e
 
 PID=$$
 
-if [ $# -ne 4 ]
+if [ $# -ne 4 -a $# -ne 5 ]
 then
   echo "This tool is for migrating primary replicas out of specified node."
-  echo "USAGE: $0 <cluster-meta-list> <migrate-node> <app-name> <run|test>"
-  echo "  app-name = * means migrate all apps"
+  echo "USAGE1: $0 <cluster-meta-list> <migrate-node> <app-name> <run|test>"
+  echo "USAGE2: $0 <shell-config-path> <migrate-node> <app-name> <run|test> 
<placeholder>"
+  echo "app-name = * means migrate all apps"
   exit 1
 fi
 
 pwd="$( cd "$( dirname "$0"  )" && pwd )"
 shell_dir="$( cd $pwd/.. && pwd )"
 cd $shell_dir
 
-cluster=$1
-node=$2
-app_name=$3
-type=$4
+if [ $# -eq 4 ]; then
+  CONFIG_SPECIFIED=0
+  cluster=$1
+  node=$2
+  app_name=$3
+  type=$4
+else
+  CONFIG_SPECIFIED=1
+  config=$1
+  node=$2
+  app_name=$3
+  type=$4
+fi

Review Comment:
   ```suggestion
   if [ $# -eq 4 ]; then
     CONFIG_SPECIFIED=0
     cluster=$1
   else
     CONFIG_SPECIFIED=1
     config=$1
   fi
   node=$2
   app_name=$3
   type=$4
   ```



##########
run.sh:
##########
@@ -1703,14 +1711,22 @@ function run_migrate_node()
         exit 1
     fi
 
-    echo "CLUSTER=$CLUSTER"
+    if [ ${CONFIG_SPECIFIED} -eq 0 ]; then
+        echo "CLUSTER=$CLUSTER"
+    else
+        echo "CONFIG=$CONFIG"
+    fi
     echo "NODE=$NODE"
     echo "APP=$APP"
     echo "TYPE=$TYPE"
     echo
     cd ${ROOT}
     echo "------------------------------"
-    ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE
+    if [ ${CONFIG_SPECIFIED} -eq 0 ]; then
+        ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE
+    else
+       ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE $CONFIG_SPECIFIED

Review Comment:
   ```suggestion
           ./scripts/migrate_node.sh $CLUSTER $NODE "$APP" $TYPE 
$CONFIG_SPECIFIED
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to