Yingyi Bu has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1700

Change subject: Enable debug option in Ansible/AWS scripts.
......................................................................

Enable debug option in Ansible/AWS scripts.

When the debug option is set to be true, for each NCDriver process:
- a debugger port is open;
- a Yourkit agent is attached and a Yourkit remote port is open.

Change-Id: Idae06144ea39a942d30d6482d96c8d8f258ec783
---
M asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
M asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
M asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/download_yourkit.yml
M asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
5 files changed, 43 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/00/1700/1

diff --git 
a/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml 
b/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
index 912fac8..b5cd1ae 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
+++ b/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
@@ -43,3 +43,14 @@
 
 # The cc service command (script).
 cc: "{{ binarydir}}/bin/{{ ccbin }}"
+
+# Whether in debug mode or not.
+# If it is true, there is a debugger port open at {{ debug_port }} and there 
is a profiler port open
+# at {{ profiler_port }}.  Note that debug mode only works if the cluster is 
on Linux machines.
+debug: false
+
+# The port for debugging
+debug_port: 20001
+
+# The port for Yourkit profiling
+profiler_port: 20002
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml 
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
index ff06614..1f513ba 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
@@ -27,3 +27,6 @@
   file:
     path: "{{ binarydir }}/logs"
     state: directory
+
+- include: download_yourkit.yml
+  when: debug
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml 
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
index 663f371..c9bf695 100644
--- a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
@@ -29,5 +29,5 @@
 - hosts: all
   tasks:
     - include_vars: ../conf/instance_settings.yml
-    - include: deploy.yml
 
+    - include: deploy.yml
diff --git 
a/asterixdb/asterix-server/src/main/opt/ansible/yaml/download_yourkit.yml 
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/download_yourkit.yml
new file mode 100644
index 0000000..2536c56
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/download_yourkit.yml
@@ -0,0 +1,24 @@
+# ------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ------------------------------------------------------------
+
+- name: Download and unzip Yourkit
+  unarchive:
+    src: https://www.yourkit.com/download/yjp-2016.02-b46.zip
+    dest: "{{ binarydir }}"
+    remote_src: true
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 66fd79c..a5b599c 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
@@ -22,6 +22,10 @@
     src: ../conf/instance/cc.conf
     dest: "{{ binarydir }}/cc.conf"
 
+- name: Populate debug option to the cluster configuration file "{{ binarydir 
}}/cc.conf"
+  shell: printf "\n[nc]\njvm.args=-Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address={{ debug_port }} 
-agentpath:{{ binarydir }}/yjp-2016.02/bin/linux-x86-64/libyjpagent.so=port={{ 
profiler_port }}\n" >> "{{ binarydir }}/cc.conf"
+  when: debug and ansible_distribution != "MacOSX"
+
 - name: Update cluster config
   shell: find -P "{{ binarydir }}/cc.conf" | xargs perl -pi -e 
's|command=asterixnc|command={{ ncbin }}|g'
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idae06144ea39a942d30d6482d96c8d8f258ec783
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyin...@gmail.com>

Reply via email to