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

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            maxwellguo Maxwell Guo Assign to me
            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:

              Slack

                Issue deployment