smiklosovic commented on code in PR #2983:
URL: https://github.com/apache/cassandra/pull/2983#discussion_r1428948377


##########
src/java/org/apache/cassandra/service/StartupChecks.java:
##########
@@ -187,6 +191,66 @@ public void verify(StartupChecksOptions options) throws 
StartupException
         }
     }
 
+    // https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057843
+    public static final StartupCheck checkKernelBug1057843 = new StartupCheck()
+    {
+        private final Range<Semver> affectedKernels = Range.closedOpen(
+        new Semver("6.1.64", Semver.SemverType.LOOSE), new Semver("6.1.66", 
Semver.SemverType.LOOSE));
+
+        private final Set<String> affectedFileSystemTypes = Set.of("ext4");
+
+        @Override
+        public void execute(StartupChecksOptions startupChecksOptions) throws 
StartupException
+        {
+            if (startupChecksOptions.isDisabled(getStartupCheckType()))
+                return;
+
+            if (!FBUtilities.isLinux)
+                return;
+
+            Set<Path> directIOWritePaths = new HashSet<>();
+            if (DatabaseDescriptor.getCommitLogWriteDiskAccessMode() == 
Config.DiskAccessMode.direct)
+                directIOWritePaths.add(new 
File(DatabaseDescriptor.getCommitLogLocation()).toPath());
+            // TODO: add data directories when direct IO is supported for 
flushing and compaction
+
+            if (!directIOWritePaths.isEmpty() && 
IGNORE_KERNEL_BUG_1057843_CHECK.getBoolean())
+            {
+                logger.info("Ignoring check for the kernel bug 1057843 against 
the following paths configured to be accessed with Direct IO: {}", 
directIOWritePaths);
+                return;
+            }
+
+            Set<Path> affectedPaths = new HashSet<>();
+            for (Path path : directIOWritePaths)
+            {
+                try
+                {
+                    if 
(affectedFileSystemTypes.contains(Files.getFileStore(path).type().toLowerCase()))
+                        affectedPaths.add(path);
+                }
+                catch (IOException e)
+                {
+                    throw new 
StartupException(StartupException.ERR_WRONG_MACHINE_STATE, "Failed to determine 
file system type for path " + path, e);
+                }
+            }
+
+            if (affectedPaths.isEmpty())
+                return;
+
+            Semver kernelVersion = FBUtilities.getKernelVersion();
+            if 
(!affectedKernels.contains(kernelVersion.withClearedSuffixAndBuild()))
+                return;
+

Review Comment:
   redundant empty line



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