asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Fix local cluster stop and erase scripts.
Date Mon, 06 Mar 2017 03:34:15 GMT
Yingyi Bu has submitted this change and it was merged.

Change subject: Fix local cluster stop and erase scripts.
......................................................................


Fix local cluster stop and erase scripts.

- Use ps to list processes
- Stop the instance first in bin/erase.sh
- Copy cc.conf to {{ binarydir }} so that it can
  be erased

Change-Id: Ib62483bfbb08ebd6f3ed97d1b64645541ce19d35
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1549
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
---
M asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
M asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
M asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
3 files changed, 14 insertions(+), 7 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; No violations found; Verified



diff --git a/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh b/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
index e7bf19d..c289996 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
+++ b/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
@@ -26,6 +26,9 @@
 
 INVENTORY=$ANSB_PATH/conf/inventory
 
+# Stop the instance first.
+$ANSB_PATH/bin/stop.sh
+
 # Erase the installation binary on all nodes.
 # TODO(yingyi): erase all data/txn/log directories.
 export ANSIBLE_HOST_KEY_CHECKING=false
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
index 7a942e9..d2fb7a3 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
@@ -20,14 +20,16 @@
 - hosts: all
   tasks:
     - name: Check CC and NC processes
-      shell: jps | egrep '(CDriver|NCService)' | awk '{print $1}'
+      shell: ps aux | awk '/[j]ava.*(CDriver|NCService)/'
       register: procs
+      failed_when: false
 
     - set_fact:
         lines: "{{ procs.stdout_lines|length }}"
 
     - name: Stop the CC and NCs
-      shell: kill `jps | egrep '(CDriver|NCService)' | awk '{print $1}'`
+      shell: kill `ps aux | awk '/[j]ava.*(CDriver|NCService)/ {print $2}'`
+      failed_when: false
       when: lines != "0"
 
     - name: Wait two seconds
@@ -35,12 +37,14 @@
       when: lines != "0"
 
     - name: Check leftover CC and NC processes
-      shell: jps | egrep '(CDriver|NCService)' | awk '{print $1}'
+      shell: ps aux | awk '/[j]ava.*(CDriver|NCService)/'
       register: procs
+      failed_when: false
 
     - set_fact:
         lines: "{{ procs.stdout_lines|length }}"
 
     - name: Force stopping leftover CC and NC processes
-      shell: kill -9 `jps | egrep '(CDriver|NCService)' | awk '{print $1}'`
+      shell: kill -9 `ps aux | awk '/[j]ava.*(CDriver|NCService)/ {print $2}'`
+      failed_when: false
       when: lines != "0"
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
index 32b1579..bb170d8 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
@@ -20,13 +20,13 @@
 - name: Copy cluster config to CC
   synchronize:
     src: /tmp/asterixdb/cc.conf
-    dest: "{{ basedir }}/cc.conf"
+    dest: "{{ binarydir }}/cc.conf"
 
 - name: Update cluster config
-  shell: find -P "{{ basedir }}/cc.conf" | xargs perl -pi -e 's|command=asterixnc|command={{
ncbin }}|g'
+  shell: find -P "{{ binarydir }}/cc.conf" | xargs perl -pi -e 's|command=asterixnc|command={{
ncbin }}|g'
 
 - name: Start CC
-  shell: nohup "{{ cc }}" -config-file "{{ basedir }}/cc.conf" &> "{{ binarydir }}/logs/cc.log"
&
+  shell: nohup "{{ cc }}" -config-file "{{ binarydir }}/cc.conf" &> "{{ binarydir
}}/logs/cc.log" &
   args:
     chdir: "{{ binarydir }}"
   async: 10

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1549
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib62483bfbb08ebd6f3ed97d1b64645541ce19d35
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message