You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2016/05/23 22:29:30 UTC

svn commit: r1745284 - in /uima/sandbox/uima-ducc/trunk/src/main: admin/ducc.py assembly/bin.xml config/cassandra config/cassandra-env.sh config/cassandra.yaml resources/cassandra-env.sh resources/cassandra.yaml

Author: burn
Date: Mon May 23 22:29:30 2016
New Revision: 1745284

URL: http://svn.apache.org/viewvc?rev=1745284&view=rev
Log:
UIMA-4944 Restore DB check for old JDK; detect IBM JDK; put in config instead of resources

Added:
    uima/sandbox/uima-ducc/trunk/src/main/config/cassandra   (with props)
    uima/sandbox/uima-ducc/trunk/src/main/config/cassandra-env.sh
      - copied, changed from r1745237, uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra-env.sh
    uima/sandbox/uima-ducc/trunk/src/main/config/cassandra.yaml
      - copied unchanged from r1745237, uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml
Removed:
    uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra-env.sh
    uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml
Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py
    uima/sandbox/uima-ducc/trunk/src/main/assembly/bin.xml

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py?rev=1745284&r1=1745283&r2=1745284&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py Mon May 23 22:29:30 2016
@@ -72,7 +72,8 @@ class Ducc(DuccUtil):
 
         os.chdir(self.DUCC_HOME + "/cassandra-server")
         pidfile = self.DUCC_HOME + '/state/cassandra.pid'
-        CMD = "bin/cassandra -p "+  pidfile + " > /dev/null 2>&1"
+        logfile = self.DUCC_HOME + '/logs/cassandra.console'
+        CMD = "bin/cassandra -p " + pidfile + " > " + logfile + " 2>&1"
         print '------- Running', CMD
 
         os.system(CMD);

Modified: uima/sandbox/uima-ducc/trunk/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/assembly/bin.xml?rev=1745284&r1=1745283&r2=1745284&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/assembly/bin.xml (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/assembly/bin.xml Mon May 23 22:29:30 2016
@@ -320,15 +320,16 @@ under the License.
         <exclude>javadac/*</exclude>
         <exclude>conf/cassandra-env.sh</exclude>
         <exclude>conf/cassandra.yaml</exclude>
+        <exclude>bin/cassandra</exclude>
         <exclude>lib/lz4*</exclude>
       </excludes>
       <fileMode>755</fileMode>
       <directoryMode>755</directoryMode>        
     </fileSet>
 
+    <!-- Slightly modified Cassandra configuration files -->
     <fileSet>
-      <directory>src/main/resources</directory>
-      <!-- Two files that post_install or some hapless human needs to set up with local information -->
+      <directory>src/main/config</directory>
       <outputDirectory>cassandra-server/conf</outputDirectory>
       <includes>
         <include>cassandra-env.sh</include>
@@ -338,6 +339,17 @@ under the License.
       <directoryMode>755</directoryMode>        
     </fileSet>
 
+    <!-- Log full Java command -->
+    <fileSet>
+      <directory>src/main/config</directory>
+      <outputDirectory>cassandra-server/bin</outputDirectory>
+      <includes>
+        <include>cassandra</include>
+      </includes>
+      <fileMode>755</fileMode>
+      <directoryMode>755</directoryMode>        
+    </fileSet>
+
     <!--    Unversioned CLI jar -->
     <fileSet>
       <directory>uima-ducc-cli/target</directory>
@@ -358,8 +370,6 @@ under the License.
       <excludes>
 		<exclude>private/*</exclude>
 		<exclude>private</exclude>
-		<exclude>cassandra-env.sh</exclude>
-		<exclude>cassandra.yaml</exclude>
 	  </excludes>
     </fileSet>
 

Added: uima/sandbox/uima-ducc/trunk/src/main/config/cassandra
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/config/cassandra?rev=1745284&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/config/cassandra (added)
+++ uima/sandbox/uima-ducc/trunk/src/main/config/cassandra Mon May 23 22:29:30 2016
@@ -0,0 +1,225 @@
+#!/bin/sh
+# 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.
+
+
+# OPTIONS:
+#   -f: start in foreground
+#   -p <filename>: log the pid to a file (useful to kill it later)
+#   -v: print version string and exit
+
+# CONTROLLING STARTUP:
+# 
+# This script relies on few environment variables to determine startup
+# behavior, those variables are:
+#
+#   CLASSPATH -- A Java classpath containing everything necessary to run.
+#   JVM_OPTS -- Additional arguments to the JVM for heap size, etc
+#   CASSANDRA_CONF -- Directory containing Cassandra configuration files.
+#
+# As a convenience, a fragment of shell is sourced in order to set one or
+# more of these variables. This so-called `include' can be placed in a 
+# number of locations and will be searched for in order. The lowest 
+# priority search path is the same directory as the startup script, and
+# since this is the location of the sample in the project tree, it should
+# almost work Out Of The Box.
+#
+# Any serious use-case though will likely require customization of the
+# include. For production installations, it is recommended that you copy
+# the sample to one of /usr/share/cassandra/cassandra.in.sh,
+# /usr/local/share/cassandra/cassandra.in.sh, or 
+# /opt/cassandra/cassandra.in.sh and make your modifications there.
+#
+# Another option is to specify the full path to the include file in the
+# environment. For example:
+#
+#   $ CASSANDRA_INCLUDE=/path/to/in.sh cassandra -p /var/run/cass.pid
+#
+# Note: This is particularly handy for running multiple instances on a 
+# single installation, or for quick tests.
+#
+# Finally, developers and enthusiasts who frequently run from an SVN 
+# checkout, and do not want to locally modify bin/cassandra.in.sh, can put
+# a customized include file at ~/.cassandra.in.sh.
+#
+# If you would rather configure startup entirely from the environment, you
+# can disable the include by exporting an empty CASSANDRA_INCLUDE, or by 
+# ensuring that no include files exist in the aforementioned search list.
+# Be aware that you will be entirely responsible for populating the needed
+# environment variables.
+
+# NB: Developers should be aware that this script should remain compatible with
+# POSIX sh and Solaris sh. This means, in particular, no $(( )) and no $( ).
+
+# If an include wasn't specified in the environment, then search for one...
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    # Locations (in order) to use when searching for an include file.
+    for include in "`dirname "$0"`/cassandra.in.sh" \
+                   "$HOME/.cassandra.in.sh" \
+                   /usr/share/cassandra/cassandra.in.sh \
+                   /usr/local/share/cassandra/cassandra.in.sh \
+                   /opt/cassandra/cassandra.in.sh; do
+        if [ -r "$include" ]; then
+            . "$include"
+            break
+        fi
+    done
+# ...otherwise, source the specified include.
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
+fi
+
+# Use JAVA_HOME if set, otherwise look for java in PATH
+if [ -n "$JAVA_HOME" ]; then
+    # Why we can't have nice things: Solaris combines x86 and x86_64
+    # installations in the same tree, using an unconventional path for the
+    # 64bit JVM.  Since we prefer 64bit, search the alternate path first,
+    # (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
+    for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
+        if [ -x "$java" ]; then
+            JAVA="$java"
+            break
+        fi
+    done
+else
+    JAVA=java
+fi
+
+if [ -z $JAVA ] ; then
+    echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. > /dev/stderr
+    exit 1;
+fi
+
+# If numactl is available, use it. For Cassandra, the priority is to
+# avoid disk I/O. Even for the purpose of CPU efficiency, we don't
+# really have CPU<->data affinity anyway. Also, empirically test that numactl
+# works before trying to use it (CASSANDRA-3245).
+NUMACTL_ARGS="--interleave=all"
+if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
+then
+    NUMACTL="numactl $NUMACTL_ARGS"
+else
+    NUMACTL=""
+fi
+
+if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
+    echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
+    exit 1
+fi
+
+if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
+    . "$CASSANDRA_CONF/cassandra-env.sh"
+fi
+
+# Special-case path variables.
+case "`uname`" in
+    CYGWIN*) 
+        CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+        CASSANDRA_CONF=`cygpath -p -w "$CASSANDRA_CONF"`
+    ;;
+esac
+
+launch_service()
+{
+    pidpath="$1"
+    foreground="$2"
+    props="$3"
+    class="$4"
+    cassandra_parms="-Dlogback.configurationFile=logback.xml"
+    cassandra_parms="$cassandra_parms -Dcassandra.logdir=$CASSANDRA_HOME/logs"
+    cassandra_parms="$cassandra_parms -Dcassandra.storagedir=$cassandra_storagedir"
+
+    if [ "x$pidpath" != "x" ]; then
+        cassandra_parms="$cassandra_parms -Dcassandra-pidfile=$pidpath"
+    fi
+
+    # The cassandra-foreground option will tell CassandraDaemon not
+    # to close stdout/stderr, but it's up to us not to background.
+    if [ "x$foreground" != "x" ]; then
+        cassandra_parms="$cassandra_parms -Dcassandra-foreground=yes"
+        exec $NUMACTL "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH" $props "$class"
+    # Startup CassandraDaemon, background it, and write the pid.
+    else
+		# For DUCC put the java command on stdout
+        echo Launch Cassandra: "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH" $props "$class"
+        exec $NUMACTL "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH" $props "$class" <&- &
+        [ ! -z "$pidpath" ] && printf "%d" $! > "$pidpath"
+        true
+    fi
+
+    return $?
+}
+
+# Parse any command line options.
+args=`getopt vfhp:bD:H:E: "$@"`
+eval set -- "$args"
+
+classname="org.apache.cassandra.service.CassandraDaemon"
+
+while true; do
+    case "$1" in
+        -p)
+            pidfile="$2"
+            shift 2
+        ;;
+        -f)
+            foreground="yes"
+            shift
+        ;;
+        -h)
+            echo "Usage: $0 [-f] [-h] [-p pidfile] [-H dumpfile] [-E errorfile]"
+            exit 0
+        ;;
+        -v)
+            "$JAVA" -cp "$CLASSPATH" org.apache.cassandra.tools.GetVersion
+            exit 0
+        ;;
+        -D)
+            properties="$properties -D$2"
+            shift 2
+        ;;
+        -H)
+            properties="$properties -XX:HeapDumpPath=$2"
+            shift 2
+        ;;
+        -E)
+            properties="$properties -XX:ErrorFile=$2"
+            shift 2
+        ;;
+        --)
+            shift
+            break
+        ;;
+        *)
+            echo "Error parsing arguments!" >&2
+            exit 1
+        ;;
+    esac
+done
+
+# see CASSANDRA-7254
+"$JAVA" -cp "$CLASSPATH" $JVM_OPTS 2>&1 | grep -q 'Error: Exception thrown by the agent : java.lang.NullPointerException'
+if [ $? -ne "1" ]; then 
+    echo Unable to bind JMX, is Cassandra already running?
+    exit 1;
+fi
+
+# Start up the service
+launch_service "$pidfile" "$foreground" "$properties" "$classname"
+
+exit $?
+
+# vi:ai sw=4 ts=4 tw=0 et

Propchange: uima/sandbox/uima-ducc/trunk/src/main/config/cassandra
------------------------------------------------------------------------------
    svn:executable = *

Copied: uima/sandbox/uima-ducc/trunk/src/main/config/cassandra-env.sh (from r1745237, uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra-env.sh)
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/config/cassandra-env.sh?p2=uima/sandbox/uima-ducc/trunk/src/main/config/cassandra-env.sh&p1=uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra-env.sh&r1=1745237&r2=1745284&rev=1745284&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra-env.sh (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/config/cassandra-env.sh Mon May 23 22:29:30 2016
@@ -94,20 +94,9 @@ jvmver=`echo "$java_ver_output" | grep '
 JVM_VERSION=${jvmver%_*}
 JVM_PATCH_VERSION=${jvmver#*_}
 
-# DUCC: These checks don't work with the IBM Jvm.  Ducc requires a 'high-enough' level of JVM
-#       so those checks will suffice.
-#if [ "$JVM_VERSION" \< "1.7" ] ; then
-#    echo "Cassandra 2.0 and later require Java 7u25 or later."
-#    exit 1;
-#fi
-
-#if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" \< "25" ] ; then
-#    echo "Cassandra 2.0 and later require Java 7u25 or later."
-#    exit 1;
-#fi
-
-
 jvm=`echo "$java_ver_output" | grep -A 1 'java version' | awk 'NR==2 {print $1}'`
+JVM_VENDOR=other
+JVM_ARCH=unknown
 case "$jvm" in
     OpenJDK)
         JVM_VENDOR=OpenJDK
@@ -115,17 +104,42 @@ case "$jvm" in
         JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
         ;;
     "Java(TM)")
-        JVM_VENDOR=Oracle
-        # this will be "64-Bit" or "32-Bit"
-        JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
-        ;;
+        # Oracle or IBM
+		jvm2=`echo "$java_ver_output" | awk 'NR==3 {print $1}'`
+        case "$jvm2" in
+			Java)
+				JVM_VENDOR=Oracle
+                # this will be "64-Bit" or "32-Bit"
+				JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
+				;;
+			IBM)
+				JVM_VENDOR=IBM
+                # this will end with "-64" or "-32"
+				JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $9}'`
+				# This should be something like 7u13-b08 or jdk7u91-b15, so extract the part between u & -
+				ORACLE_VER=`echo "$java_ver_output" | awk 'NR==8 {print $7}'`
+				ORACLE_VER=${ORACLE_VER#*u}
+				JVM_PATCH_VERSION=${ORACLE_VER%-*}
+				;;
+			*)
+				;;
+		esac
+		;;
     *)
-        # Help fill in other JVM values
-        JVM_VENDOR=other
-        JVM_ARCH=unknown
+        # Unknown
         ;;
 esac
 
+if [ "$JVM_VERSION" \< "1.7" ] ; then
+    echo "Cassandra 2.0 and later require Java 7u25 or later."
+    exit 1;
+fi
+
+if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt "25" ] ; then
+    echo "Cassandra 2.0 and later require Java 7u25 or later."
+    exit 1;
+fi
+
 
 # Override these to set the amount of memory to allocate to the JVM at
 # start-up. For production use you may wish to adjust this for your
@@ -315,6 +329,13 @@ fi
 #MX4J_ADDRESS="-Dmx4jaddress=127.0.0.1"
 #MX4J_PORT="-Dmx4jport=8081"
 
+# For IBM Java add options to log them, create a dump, avoid unsafe inlining (PMR 71796,001,866)
+if [ "$JVM_VENDOR" == "IBM" ] ; then
+	JVM_OPTS="$JVM_OPTS -XshowSettings"
+	JVM_OPTS="$JVM_OPTS -Xdump:java+system+snap:events=gpf+abort"
+	JVM_OPTS="$JVM_OPTS -Xjit:dontInline={org/apache/cassandra/utils/concurrent/Locks.monitorEnterUnsafe*,org/apache/cassandra/utils/concurrent/Locks.monitorExitUnsafe*}"
+fi
+
 JVM_OPTS="$JVM_OPTS $MX4J_ADDRESS"
 JVM_OPTS="$JVM_OPTS $MX4J_PORT"
 JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"