josh-mckenzie commented on code in PR #1755:
URL: https://github.com/apache/cassandra/pull/1755#discussion_r932358125


##########
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:
   I'm more noodling on if we should open a JIRA to make this consistent across 
the codebase. It bothers me when I find inconsistent grammar on things 
(comments not capitalized, indentation, cassandra vs. Cassandra, etc)



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