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/07/26 20:51:34 UTC

[GitHub] [cassandra] smiklosovic commented on a diff in pull request #1755: Cassandra 17777 - Warn on unknown directories found in system keyspace directory rather than kill node during startup checks

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


##########
src/java/org/apache/cassandra/service/StartupChecks.java:
##########
@@ -571,6 +571,25 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes attrs)
 
                 public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException
                 {
+                    String[] nameParts = dir.toFile().getCanonicalPath().split(java.io.File.separator);
+                    if (nameParts.length >= 2)
+                    {
+                        String tablePart = nameParts[nameParts.length - 1];
+                        String ksPart = nameParts[nameParts.length - 2];
+
+                        if (tablePart.contains("-"))
+                            tablePart = tablePart.split("-")[0];
+
+                        // In very old versions of cassandra, we wouldn't necessarily delete sstables from dropped system tables
+                        // which were removed in various major version upgrades (e.g system.Versions in 1.2)
+                        if (ksPart.equals(SchemaConstants.SYSTEM_KEYSPACE_NAME) && !SystemKeyspace.ALL_TABLE_NAMES.contains(tablePart))
+                        {
+                            logger.warn("Found unknown system directory {}.{} at {} - this is likely left over from a previous " +
+                                        "version of cassandra and should be removed after inspection." , ksPart, tablePart, dir.toFile().getCanonicalPath());

Review Comment:
   cassandra -> Cassandra



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