Madhav created CASSANDRA-14178:
----------------------------------

             Summary: MAX_TTL doesn't account for leap years currently
                 Key: CASSANDRA-14178
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14178
             Project: Cassandra
          Issue Type: Bug
          Components: Configuration, Core, CQL
            Reporter: Madhav


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.
{code:java}
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
{code}
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|https://github.com/apache/cassandra/commit/46fc843bbd39bf6b007fb6d1c8e823f8b3ba2425]
 part of CASSANDRA-4771



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to