blambov commented on code in PR #3477:
URL: https://github.com/apache/cassandra/pull/3477#discussion_r1718080973


##########
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:
   Nits: 
   
   I would remove "now" from the message, or replace it with "by the file 
system".
   
   I personally would just throw the exception inside 
`resolveCommitLogWriteDiskAccessMode` to avoid returning pairs, but I'm happy 
to accept this version as well.



-- 
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