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

We should throw exception when commitlog 's DiskAccessMode is direct but direct io is not support

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 5.0.1, 5.1
    • Local/Commit Log
    • None

    Description

      Looking into the code below :

      private static DiskAccessMode resolveCommitLogWriteDiskAccessMode(DiskAccessMode providedDiskAccessMode)
          {
              boolean compressOrEncrypt = getCommitLogCompression() != null || (getEncryptionContext() != null && getEncryptionContext().isEnabled());
              boolean directIOSupported = false;
              try
              {
                  directIOSupported = FileUtils.getBlockSize(new File(getCommitLogLocation())) > 0;
              }
              catch (RuntimeException e)
              {
                  logger.warn("Unable to determine block size for commit log directory: {}", e.getMessage());
              }
      
              if (providedDiskAccessMode == DiskAccessMode.auto)
              {
                  if (compressOrEncrypt)
                      providedDiskAccessMode = DiskAccessMode.legacy;
                  else
                  {
                      providedDiskAccessMode = directIOSupported && conf.disk_optimization_strategy == Config.DiskOptimizationStrategy.ssd ? DiskAccessMode.direct
                                                                                                                                           : DiskAccessMode.legacy;
                  }
              }
      
              if (providedDiskAccessMode == DiskAccessMode.legacy)
              {
                  providedDiskAccessMode = compressOrEncrypt ? DiskAccessMode.standard : DiskAccessMode.mmap;
              }
      
              return providedDiskAccessMode;
          }
      

      We should throw exception when user set the DiskAccessMode to direct for commitlog but the directIOSupported return false after the judgement of "FileUtils.getBlockSize(new File(getCommitLogLocation())) > 0;" instead of waiting for the system to start and accepting reads and writes.

      Attachments

        1. CASSANDRA-19812_58_ci_summary.html
          5.24 MB
          Michael Semb Wever
        2. CASSANDRA-19812_58_results_details.tar.xz
          6.78 MB
          Michael Semb Wever

        Activity

          People

            maxwellguo Maxwell Guo
            maxwellguo Maxwell Guo
            Maxwell Guo
            Branimir Lambov, Stefan Miklosovic
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: