Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-8890

Enhance cassandra-env.sh to handle Java version output in case of OpenJDK icedtea"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 3.6
    • Local/Config
    • Red Hat Enterprise Linux Server release 6.4 (Santiago)

    Description

      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.

      Attachments

        1. 8890-v2.txt
          0.4 kB
          Brandon Williams
        2. trunk-8890.patch
          0.9 kB
          Sumod Pawgi
        3. trunk-8890.txt
          13 kB
          Sumod Pawgi

        Activity

          People

            brandon.williams Brandon Williams
            spawgi Sumod Pawgi
            Brandon Williams
            Michael Shuler
            Sumod Pawgi Sumod Pawgi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: