[ 
https://issues.apache.org/jira/browse/CASSANDRA-20073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brandon Williams updated CASSANDRA-20073:
-----------------------------------------
    Resolution: Duplicate
        Status: Resolved  (was: Triage Needed)

> AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() 
> but later compared and updated with System.nanoTime() 
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-20073
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20073
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Commit Log
>            Reporter: Dmitry Konstantinov
>            Priority: Normal
>
> Within org.apache.cassandra.db.commitlog.AbstractCommitLogService
> we use System.currentMillis()-based time to initialize lastSyncedAt field:
> {code:java}
> protected volatile long lastSyncedAt = currentTimeMillis();{code}
> but later we use clock.now() = System.nanoTime() to compare and update the 
> field value:
> {code:java}
> long pollStarted = clock.now();
> boolean flushToDisk = lastSyncedAt + syncIntervalNanos <= pollStarted || 
> state != NORMAL || syncRequested; {code}
> As of now we are lucky that in the current JDK implementation  
> System.nanoTime()  is much bigger than currentTimeMillis() but it is not 
> guaranteed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to