You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/01/02 15:42:54 UTC

[GitHub] [cassandra] subkanthi commented on a change in pull request #1354: [16436] - Added startup check for read_ahead_kb setting.

subkanthi commented on a change in pull request #1354:
URL: https://github.com/apache/cassandra/pull/1354#discussion_r777225477



##########
File path: src/java/org/apache/cassandra/service/StartupChecks.java
##########
@@ -243,8 +247,8 @@ private void checkOutOfMemoryHandling()
             {
                 if (!jvmOptionsContainsOneOf("-XX:OnOutOfMemoryError="))
                     logger.warn("The JVM is not configured to stop on OutOfMemoryError which can cause data corruption."
-                            + " Either upgrade your JRE to a version greater or equal to 8u92 and use -XX:+ExitOnOutOfMemoryError/-XX:+CrashOnOutOfMemoryError"
-                            + " or use -XX:OnOutOfMemoryError=\"<cmd args>;<cmd args>\" on your current JRE.");
+                                + " Either upgrade your JRE to a version greater or equal to 8u92 and use -XX:+ExitOnOutOfMemoryError/-XX:+CrashOnOutOfMemoryError"

Review comment:
       Removed, thanks.

##########
File path: src/java/org/apache/cassandra/service/StartupChecks.java
##########
@@ -498,23 +573,45 @@ public void execute() throws StartupException
             throw new StartupException(StartupException.ERR_WRONG_CONFIG, errMsg.get());
     };
 
+    @VisibleForTesting
+    public static String getReadAheadKBPath(String blockDirectoryPath)
+    {
+        String readAheadKBPath = null;
+
+        final String READ_AHEAD_KB_SETTING_PATH = "/sys/block/%s/queue/read_ahead_kb";
+        try
+        {
+            String deviceName = blockDirectoryPath.split("/")[2].replaceAll("[0-9]*$", "");
+
+            if (StringUtils.isNotEmpty(deviceName))
+            {
+                readAheadKBPath = String.format(READ_AHEAD_KB_SETTING_PATH, deviceName);
+            }
+        }
+        catch (Exception e)
+        {
+            logger.error("Error retrieving device path for {}.", blockDirectoryPath);
+        }
+
+        return readAheadKBPath;
+    }
+
     @VisibleForTesting
     static Optional<String> checkLegacyAuthTablesMessage()
     {
         List<String> existing = new ArrayList<>(SchemaConstants.LEGACY_AUTH_TABLES).stream().filter((legacyAuthTable) ->
-            {
-                UntypedResultSet result = QueryProcessor.executeOnceInternal(String.format("SELECT table_name FROM %s.%s WHERE keyspace_name='%s' AND table_name='%s'",
-                                                                                           SchemaConstants.SCHEMA_KEYSPACE_NAME,
-                                                                                           "tables",
-                                                                                           SchemaConstants.AUTH_KEYSPACE_NAME,
-                                                                                           legacyAuthTable));
-                return result != null && !result.isEmpty();
-            }).collect(Collectors.toList());
+        {
+            UntypedResultSet result = QueryProcessor.executeOnceInternal(String.format("SELECT table_name FROM %s.%s WHERE keyspace_name='%s' AND table_name='%s'",
+                                                                                       SchemaConstants.SCHEMA_KEYSPACE_NAME, "tables", SchemaConstants.AUTH_KEYSPACE_NAME, legacyAuthTable));
+            return result != null && !result.isEmpty();
+        }).collect(Collectors.toList());
 
         if (!existing.isEmpty())
             return Optional.of(String.format("Legacy auth tables %s in keyspace %s still exist and have not been properly migrated.",
-                        Joiner.on(", ").join(existing), SchemaConstants.AUTH_KEYSPACE_NAME));
+                                             Joiner.on(", ").join(existing), SchemaConstants.AUTH_KEYSPACE_NAME));

Review comment:
       Removed.

##########
File path: src/java/org/apache/cassandra/service/StartupChecks.java
##########
@@ -498,23 +573,45 @@ public void execute() throws StartupException
             throw new StartupException(StartupException.ERR_WRONG_CONFIG, errMsg.get());
     };
 
+    @VisibleForTesting
+    public static String getReadAheadKBPath(String blockDirectoryPath)
+    {
+        String readAheadKBPath = null;
+
+        final String READ_AHEAD_KB_SETTING_PATH = "/sys/block/%s/queue/read_ahead_kb";
+        try
+        {
+            String deviceName = blockDirectoryPath.split("/")[2].replaceAll("[0-9]*$", "");
+
+            if (StringUtils.isNotEmpty(deviceName))
+            {
+                readAheadKBPath = String.format(READ_AHEAD_KB_SETTING_PATH, deviceName);
+            }
+        }
+        catch (Exception e)
+        {
+            logger.error("Error retrieving device path for {}.", blockDirectoryPath);
+        }
+
+        return readAheadKBPath;
+    }
+
     @VisibleForTesting
     static Optional<String> checkLegacyAuthTablesMessage()
     {
         List<String> existing = new ArrayList<>(SchemaConstants.LEGACY_AUTH_TABLES).stream().filter((legacyAuthTable) ->
-            {
-                UntypedResultSet result = QueryProcessor.executeOnceInternal(String.format("SELECT table_name FROM %s.%s WHERE keyspace_name='%s' AND table_name='%s'",
-                                                                                           SchemaConstants.SCHEMA_KEYSPACE_NAME,
-                                                                                           "tables",
-                                                                                           SchemaConstants.AUTH_KEYSPACE_NAME,
-                                                                                           legacyAuthTable));
-                return result != null && !result.isEmpty();
-            }).collect(Collectors.toList());
+        {

Review comment:
       Removed.




-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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