You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jo...@apache.org on 2025/02/05 20:59:24 UTC

(cassandra) branch cassandra-5.0 updated: Skip check for DirectIO when initializing tools.

This is an automated email from the ASF dual-hosted git repository.

jonmeredith pushed a commit to branch cassandra-5.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-5.0 by this push:
     new f97c945afb Skip check for DirectIO when initializing tools.
f97c945afb is described below

commit f97c945afb76b9fc49d8663c475ae931d30c3713
Author: Jon Meredith <jo...@apache.org>
AuthorDate: Tue Feb 4 17:52:24 2025 -0700

    Skip check for DirectIO when initializing tools.
    
    Patch by Jon Meredith; reviewed by Stefan Miklosovic for CASSANDRA-20289
---
 CHANGES.txt                                        |  1 +
 .../cassandra/config/DatabaseDescriptor.java       | 34 ++++++++++++----------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index b3cfd59476..769e4dddbe 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 5.0.4
+ * Skip check for DirectIO when initializing tools (CASSANDRA-20289)
  * Avoid under-skipping during intersections when an iterator has mixed STATIC and WIDE keys (CASSANDRA-20258)
  * Correct the default behavior of compareTo() when comparing WIDE and STATIC PrimaryKeys (CASSANDRA-20238)
 Merged from 4.1:
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 4a11285e41..6de2c7473d 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -1480,24 +1480,28 @@ public class DatabaseDescriptor
     {
         boolean compressOrEncrypt = getCommitLogCompression() != null || (getEncryptionContext() != null && getEncryptionContext().isEnabled());
         boolean directIOSupported = false;
-        try
+        // File.getBlockSize creates directories/files tools may not have permissions for
+        if (!toolInitialized)
         {
-            String commitLogLocation = getCommitLogLocation();
+            try
+            {
+                String commitLogLocation = getCommitLogLocation();
 
-            if (commitLogLocation == null)
-                throw new ConfigurationException("commitlog_directory must be specified", false);
+                if (commitLogLocation == null)
+                    throw new ConfigurationException("commitlog_directory must be specified", false);
 
-            File commitLogLocationDir = new File(commitLogLocation);
-            PathUtils.createDirectoriesIfNotExists(commitLogLocationDir.toPath());
-            directIOSupported = FileUtils.getBlockSize(commitLogLocationDir) > 0;
-        }
-        catch (IOError | ConfigurationException ex)
-        {
-            throw  ex;
-        }
-        catch (RuntimeException e)
-        {
-            logger.warn("Unable to determine block size for commit log directory: {}", e.getMessage());
+                File commitLogLocationDir = new File(commitLogLocation);
+                PathUtils.createDirectoriesIfNotExists(commitLogLocationDir.toPath());
+                directIOSupported = FileUtils.getBlockSize(commitLogLocationDir) > 0;
+            }
+            catch (IOError | ConfigurationException ex)
+            {
+                throw ex;
+            }
+            catch (RuntimeException e)
+            {
+                logger.warn("Unable to determine block size for commit log directory: {}", e.getMessage());
+            }
         }
 
         if (providedDiskAccessMode == DiskAccessMode.auto)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org