You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2017/03/06 03:35:59 UTC

asterixdb git commit: Fix local cluster stop and erase scripts.

Repository: asterixdb
Updated Branches:
  refs/heads/master 983dd1874 -> 7109cc18c


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 <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/7109cc18
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/7109cc18
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/7109cc18

Branch: refs/heads/master
Commit: 7109cc18c6a7e815b45c77bb3e75d8462ba2bb78
Parents: 983dd18
Author: Yingyi Bu <yi...@couchbase.com>
Authored: Sun Mar 5 15:34:57 2017 -0800
Committer: Yingyi Bu <bu...@gmail.com>
Committed: Sun Mar 5 19:33:58 2017 -0800

----------------------------------------------------------------------
 .../asterix-server/src/main/opt/ansible/bin/erase.sh    |  3 +++
 .../src/main/opt/ansible/yaml/instance_stop.yml         | 12 ++++++++----
 .../src/main/opt/ansible/yaml/start_cc.yml              |  6 +++---
 3 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7109cc18/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
----------------------------------------------------------------------
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 @@ ANSB_PATH=`dirname "${SCRIPT_PATH}"`
 
 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

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7109cc18/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
----------------------------------------------------------------------
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"

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7109cc18/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
----------------------------------------------------------------------
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