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

Incorrect check for -Xlog in cassandra-env.sh

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0-rc1, 4.0
    • Packaging
    • None
    • Code
    • Low
    • Low Hanging Fruit
    • User Report
    • All
    • None
    • Hide

      The change is verified by uncommenting the gc log option in the respective server.options file (8, 11) and checking that the options from cassandra-ev.sh are not added if those are already present.

      Show
      The change is verified by uncommenting the gc log option in the respective server.options file ( 8 , 11 ) and checking that the options from cassandra-ev.sh are not added if those are already present.

    Description

      Possible small bug in cassandra-env.sh of Cassandra 4:
      https://github.com/apache/cassandra/blob/trunk/conf/cassandra-env.sh#L98
      The following command incorrect:

       echo "$JVM_OPTS" | grep -q "^-[X]log:gc"
      

      Should be:

      echo "$JVM_OPTS" | grep -qe "-[X]log:gc"
      

      The variable  $JVM_OPTS not starting with -Xlog..  , and always return 1, remove ^ and add -qe  will solve the problem.
      It's causing that cassandra-env.sh  ignoring variable of -Xlog  in jvm11-server.options and jvm8-server.options

       

      Right now, jvm11-server.options with:

      -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=100M

      Will generate process of:

      -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=100M -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
      

      With fix it will generate correct gc option of :

      -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=100M
      

      Attachments

        Activity

          People

            aholmber Adam Holmberg
            yakir.g Yakir Gibraltar
            Adam Holmberg
            Adam Holmberg, Michael Semb Wever
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: