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


##########
src/java/org/apache/cassandra/service/snapshot/SnapshotLoader.java:
##########
@@ -149,7 +154,37 @@ private void loadSnapshotFromDir(Matcher 
snapshotDirMatcher, Path snapshotDir)
         {
             String keyspaceName = snapshotDirMatcher.group("keyspace");
             String tableName = snapshotDirMatcher.group("tableName");
-            UUID tableId = parseUUID(snapshotDirMatcher.group("tableId"));
+            final UUID tableId;
+            if (snapshotDirMatcher.group("tableId") == null)
+            {
+                logger.debug("Snapshot directory without tableId found 
(pre-2.1 format): {}", snapshotDir);
+                // If we don't have a tableId in folder name (e.g pre 2.1 
created table)
+                // Then attempt to get tableId from CFS on startup
+                // falling back to null is fine as it still yields a unique 
result in buildSnapshotId for pre-2.1 table
+                if (Keyspace.isInitialized() && 
Schema.instance.getKeyspaceMetadata(keyspaceName) != null)
+                {
+                    ColumnFamilyStore cfs = 
ColumnFamilyStore.getIfExists(keyspaceName, tableName);
+                    tableId = cfs != null && cfs.metadata.id != null
+                              ? cfs.metadata.id.asUUID()
+                              : null;
+
+                    if (tableId == null)
+                    {
+                        logger.warn("Snapshot directory without tableId found 
(pre-2.1 format) " +

Review Comment:
   Snapshot directory without table id found (pre-2.1 format), unable to 
resolve table id from column family, defaulting to null, snapshot dir: {} 



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