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


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

Review Comment:
   
   @josh-mckenzie 
   
   what happens when I have this on disk?
   
   
/var/lib/cassandra/data/demo/tb1-d26731900d2611edbc7601a9bc5ba989/snapshots/system/.tb1_batches_idx/
   
   This would be created when I take a snapshot with tag "system" on a table 
called tb1 which has an index on column called "batches".
   
   Is not it true that your check would falsly detect this?



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