Maxwell-Guo commented on code in PR #3477:
URL: https://github.com/apache/cassandra/pull/3477#discussion_r1718105170


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1499,20 +1500,24 @@ private static DiskAccessMode 
resolveCommitLogWriteDiskAccessMode(DiskAccessMode
             providedDiskAccessMode = compressOrEncrypt ? 
DiskAccessMode.standard : DiskAccessMode.mmap;
         }
 
-        return providedDiskAccessMode;
+        return Pair.create(providedDiskAccessMode, directIOSupported);
     }
 
-    private static void validateCommitLogWriteDiskAccessMode(DiskAccessMode 
diskAccessMode) throws ConfigurationException
+    private static void 
validateCommitLogWriteDiskAccessMode(Pair<DiskAccessMode, Boolean> 
accessModeDirectIoPair) throws ConfigurationException
     {
         boolean compressOrEncrypt = getCommitLogCompression() != null || 
(getEncryptionContext() != null && getEncryptionContext().isEnabled());
 
-        if (compressOrEncrypt && diskAccessMode != DiskAccessMode.standard)
+        if (!accessModeDirectIoPair.right && accessModeDirectIoPair.left == 
DiskAccessMode.direct)
         {
-            throw new ConfigurationException("commitlog_disk_access_mode = " + 
diskAccessMode + " is not supported with compression or encryption. Please use 
'auto' when unsure.", false);
+            throw new ConfigurationException("commitlog_disk_access_mode can 
not be set to direct when direct IO is not supported now.");

Review Comment:
   Thank you for your reply. The first time I  also threw the exception inside 
resolveCommitLogWriteDiskAccessMode function, but as I saw a 
validateCommitLogWriteDiskAccessMode function, I wanted to classify all the 
validation  into this function.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to