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


##########
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java:
##########
@@ -175,7 +177,10 @@ static long getNextId()
 
         try
         {
-            channel = FileChannel.open(logFile.toPath(), 
StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.CREATE);
+            if(commitLog.configuration.isDirectIOEnabled())
+                channel = FileChannel.open(logFile.toPath(), 
StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.CREATE, 
ExtendedOpenOption.DIRECT);

Review Comment:
   Does this also change the compressed and encrypted segments to use 
non-cached access? Could we also benchmark LZ4-compressed commit log with and 
without the flag?



##########
conf/cassandra.yaml:
##########
@@ -2110,3 +2110,6 @@ drop_compact_storage_enabled: false
 #   a stable cluster. If a node from a previous version was started by 
accident we won't any longer toggle behaviors as when UPGRADING.
 #
 storage_compatibility_mode: CASSANDRA_4
+
+# Enable Direct I/O feature for Commitlog files. Java-11 forces minimum 
alignement to 4K and minimum disk write to 4K.
+direct_io_for_commitlog_enabled: true

Review Comment:
   This setting should move with the other commit log settings, e.g. 
[here](https://github.com/apache/cassandra/blob/624af90bab0d7f5f08de0b9d30cb212186c6bbdf/conf/cassandra.yaml#L582),
 and the value needs to be an enum (with values `direct` and `mmap`), so that 
users can understand what each option means.
   See e.g. the implementation of `disk_access_mode`.
   
   It also makes sense to unit test that the option is properly understood 
(i.e. that the object created by `CommitLog.createSegment` is of the correct 
type).
   
   While I personally would prefer to switch to direct by default, please ask 
on dev mailing list or at least in the JIRA ticket if anyone is opposed to that 
as it might catch someone by surprise.



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