Sumod Pawgi created CASSANDRA-8890:
--------------------------------------
Summary: Enhance cassandra-env.sh to handle Java version output in
case of OpenJDK icedtea"
Key: CASSANDRA-8890
URL: https://issues.apache.org/jira/browse/CASSANDRA-8890
Project: Cassandra
Issue Type: Improvement
Components: Config
Environment: Red Hat Enterprise Linux Server release 6.4 (Santiago)
Reporter: Sumod Pawgi
Priority: Minor
Fix For: 2.1.4
Where observed -
Cassandra node has OpenJDK -
java version "1.7.0_09-icedtea"
In some situations, external agents trying to monitor a C* cluster would need
to run cassandra -v command to determine the Cassandra version and would expect
a numerical output e.g. java version "1.7.0_75" as in case of Oracle JDK. But
if the cluster has OpenJDK IcedTea installed, then this condition is not
satisfied and the agents will not work correctly as the output from "cassandra
-v" is
/opt/apache/cassandra/bin/../conf/cassandra-env.sh: line 102: [: 09-icedtea:
integer expression expected
Cause -
The line which is causing this behavior is -
jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"'
'NR==1 {print $2}'`
Suggested enhancement -
If we change the line to -
jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"'
'NR==1 {print $2}' | awk 'BEGIN {FS="-"};{print $1}'`,
it will give $jvmver as - 1.7.0_09 for the above case.
Can we add this enhancement in the cassandra-env.sh? I would like to add it
myself and submit for review, but I am not familiar with C* check in process.
There might be better ways to do this, but I thought of this to be simplest and
as the edition is at the end of the line, it will be easy to reverse if needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)