You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2019/04/13 00:18:18 UTC

[asterixdb] 05/06: [NO ISSUE][*DB] Warn (not fail) on running *DB processes on sample start

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

dlych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit fab68d291e12973a4c28f9150067f8fc00d56475
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Fri Apr 12 12:48:53 2019 -0400

    [NO ISSUE][*DB] Warn (not fail) on running *DB processes on sample start
    
    also, fix printing of running processes post sample stop
    
    Change-Id: I84037ad5f64536bafcb7c9500b9a7668e6849156
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3341
    Reviewed-by: Ian Maxon <im...@uci.edu>
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
---
 .../main/opt/local/bin/start-sample-cluster.bat    | 21 +++++--------------
 .../src/main/opt/local/bin/start-sample-cluster.sh | 24 +++++-----------------
 .../src/main/opt/local/bin/stop-sample-cluster.sh  |  2 +-
 3 files changed, 11 insertions(+), 36 deletions(-)

diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
index 60f5cb5..652abff 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
@@ -32,9 +32,9 @@ exit /B 0
 if "%1" == "" goto postopts
 
 if "%1" == "-f" (
-  set force=1
+  rem ignored, this is always the case
 ) else if "%1" == "-force" (
-  set force=1
+  rem ignored, this is always the case
 ) else if "%1" == "-usage" (
   goto :usage
 ) else if "%1" == "-help" (
@@ -80,23 +80,12 @@ wmic process where ^
   "name='java.exe' and CommandLine like '%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine like '%%app.name=\"%%[cn]c\"%%' or CommandLine like '%%app.name=\"%%ncservice\"%%')" ^
   GET processid > %tempfile% 2> nul
 
-set severity=ERROR
-if "%force%" == "1" set severity=WARNING
-
 for /F "skip=1" %%P in ('type %tempfile%') DO set found=1
 
 if "%found%" == "1" (
-  if "%force%" == "1" (
-    echo %severity%: ${PRODUCT} processes are already running; -f[orce] specified, ignoring
-    del %tempfile%
- ) else (
-    echo %severity%: ${PRODUCT} processes are already running; aborting"
-    echo.
-    echo Re-run with -f to ignore, or run stop-sample-cluster.bat -f to forcibly terminate all running ${PRODUCT} processes:
-    for /F "skip=1" %%P in ('type %tempfile%') DO @echo     - %%P
-    del %tempfile%
-    exit /B 1
-  )
+  echo WARNING: ${PRODUCT} processes are already running:
+  for /F "skip=1" %%P in ('type %tempfile%') DO @echo     - %%P
+  del %tempfile%
 )
 
 goto :post_timestamp
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.sh b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.sh
index 34d156c..9268bed 100755
--- a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.sh
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.sh
@@ -20,14 +20,13 @@
 
 function usage() {
   echo
-  echo Usage: $(basename $0) [-f[orce]]
+  echo Usage: $(basename $0)
   echo
-  echo "  -f[orce]  : Forces a start attempt when ${PRODUCT} processes are found to be running"
 }
 
 while [ -n "$1" ]; do
   case $1 in
-    -f|-force) force=1;;
+    -f|-force);; # ignored, this is always the case
     -help|--help|-usage|--usage) usage; exit 0;;
     *) echo "ERROR: unknown argument '$1'"; usage; exit 1;;
   esac
@@ -115,22 +114,9 @@ mkdir -p "$LOGSDIR"
     && echo "ERROR: sample cluster address (localhost:${LISTEN_PORT}) already in use" && exit 1
 
 if ps -ef | grep 'java.*org\.apache\.hyracks\.control\.[cn]c\.\([CN]CDriver\|service\.NCService\)' > /tmp/$$_pids; then
-  if [ $force ]; then
-    severity=WARNING
-  else
-    severity=ERROR
-  fi
-  echo -n "${severity}: ${PRODUCT} processes are already running; "
-  if [ $force ]; then
-    echo "-f[orce] specified, ignoring"
-  else
-    echo "aborting"
-    echo
-    echo "Re-run with -f to ignore, or run stop-sample-cluster.sh -f to forcibly terminate all running ${PRODUCT} processes:"
-    cat /tmp/$$_pids |  sed 's/^ *[0-9]* \([0-9]*\).*org\.apache\.hyracks\.control\.[cn]c[^ ]*\.\([^ ]*\) .*/\1 - \2/'
-    rm /tmp/$$_pids
-    exit 1
-  fi
+  echo "WARNING: ${PRODUCT} processes are already running:"
+  cat /tmp/$$_pids |  sed 's/^ *[0-9]* \([0-9]*\).*org\.apache\.hyracks\.control\.[cn]c[^ ]*\.\([^ ]*\) .*/\1 - \2/'
+  rm /tmp/$$_pids
 fi
 
 rm /tmp/$$_pids
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
index 80647d4..97473ac 100755
--- a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
@@ -146,7 +146,7 @@ if ps -ef | grep 'java.*org\.apache\.hyracks\.control\.[cn]c\.\([CN]CDriver\|ser
     done
   else
     echo "re-run with -f|-force to forcibly terminate all ${PRODUCT} processes:"
-    cat /tmp/pids |  sed 's/^ *[0-9]* \([0-9]*\).*org\.apache\.hyracks\.control\.[cn]c[^ ]*\.\([^ ]*\) .*/\1 - \2/'
+    cat /tmp/$$_pids |  sed 's/^ *[0-9]* \([0-9]*\).*org\.apache\.hyracks\.control\.[cn]c[^ ]*\.\([^ ]*\) .*/\1 - \2/'
   fi
 fi
 rm /tmp/$$_pids