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

MAX_TTL doesn't account for leap years currently

    XMLWordPrintableJSON

Details

    • Low

    Description

      Currently at the trunk (and in all prior versions), we've MAX_TTL value defined as 20 years in seconds, which really isn't 20 years as it currently doesn't account for leap years.

      https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/Attributes.java#L43
      
      /**
      * If this limit is ever raised, make sure @{@link Integer#MAX_VALUE} is not allowed,
      * as this is used as a flag to represent expired liveness.
      *
      * See {@link org.apache.cassandra.db.LivenessInfo#EXPIRED_LIVENESS_TTL}
      */
      public static final int MAX_TTL = 20 * 365 * 24 * 60 * 60; // 20 years in seconds
      

      Either perform actual date calculation to account for leap years or not call it as "20 years in seconds" as this breaks many code relying on it for playing with dates.

       

      This was originally introduced as part of this commit part of CASSANDRA-4771

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              madhavs Madhav
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: