Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Duplicate
-
None
-
None
-
All
-
None
Description
Within org.apache.cassandra.db.commitlog.AbstractCommitLogService
we use System.currentMillis()-based time to initialize lastSyncedAt field:
protected volatile long lastSyncedAt = currentTimeMillis();
but later we use clock.now() = System.nanoTime() to compare and update the field value:
long pollStarted = clock.now(); boolean flushToDisk = lastSyncedAt + syncIntervalNanos <= pollStarted || state != NORMAL || syncRequested;
As of now we are lucky that in the current JDK implementation System.nanoTime() is much bigger than currentTimeMillis() but it is not guaranteed.
Attachments
Issue Links
- duplicates
-
CASSANDRA-20074 AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() but later compared and updated with System.nanoTime()
- Resolved