You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Dmitry Konstantinov (Jira)" <ji...@apache.org> on 2024/11/12 13:13:00 UTC
[jira] [Created] (CASSANDRA-20074) AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() but later compared and updated with System.nanoTime()
Dmitry Konstantinov created CASSANDRA-20074:
-----------------------------------------------
Summary: AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() but later compared and updated with System.nanoTime()
Key: CASSANDRA-20074
URL: https://issues.apache.org/jira/browse/CASSANDRA-20074
Project: Cassandra
Issue Type: Bug
Components: Local/Commit Log
Reporter: Dmitry Konstantinov
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: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org