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

Fix batch commitlog sync regression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.0.17, 3.11.3, 4.0-alpha1, 4.0
    • None
    • None
    • Normal

    Description

      Prior to CASSANDRA-13987, in batch commitlog mode, commitlog will be synced to disk right after mutation comes.

      • haveWork semaphore is released in BatchCommitLogService.maybeWaitForSync
      • AbstractCommitlogService will continue and sync to disk

      After C-13987, it makes a branch for chain maker flush more frequently in periodic mode. To make sure in batch mode CL still flushes immediately, it added syncRequested flag.
      Unfortunately, in 3.0 branch, this flag is not being set to true when mutation is waiting.

      So in AbstractCommitlogService, it will not execute the CL sync branch until it reaches sync window(2ms)..

      AbstractCommitLogService.java
      if (lastSyncedAt + syncIntervalMillis <= pollStarted || shutdown || syncRequested)
      {
          // in this branch, we want to flush the commit log to disk
          syncRequested = false;
          commitLog.sync(shutdown, true);
          lastSyncedAt = pollStarted;
          syncComplete.signalAll();
      }
      else
      {
          // in this branch, just update the commit log sync headers
          commitLog.sync(false, false);
      }
      

      Attachments

        1. 14292-3.0-dtest.png
          770 kB
          Zhao Yang
        2. 14292-3.0-unittest.png
          117 kB
          Zhao Yang

        Issue Links

          Activity

            People

              jasonstack Zhao Yang
              jasonstack Zhao Yang
              Zhao Yang
              Jason Brown
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: