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

AbstractCommitLogService#lastSyncedAt initialized with currentTimeMillis() but later compared and updated with System.nanoTime()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • None
    • Local/Commit Log
    • 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

          Activity

            People

              Unassigned Unassigned
              dnk Dmitry Konstantinov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: