You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "jrwest (via GitHub)" <gi...@apache.org> on 2025/01/14 17:46:26 UTC

Re: [PR] CASSANDRA-20150 Create snapshot manifest upon loading where it does not exist or enrich it [cassandra]

jrwest commented on code in PR #3751:
URL: https://github.com/apache/cassandra/pull/3751#discussion_r1915340814


##########
src/java/org/apache/cassandra/service/snapshot/TableSnapshot.java:
##########
@@ -490,8 +496,110 @@ private void loadMetadataFromManifest(File manifestFile)
 
         TableSnapshot build()
         {
+            maybeCreateOrEnrichManifest();
             return new TableSnapshot(keyspaceName, tableName, tableId, tag, createdAt, expiresAt, snapshotDirs, ephemeral);
         }
+
+        private void maybeCreateOrEnrichManifest()
+        {
+            boolean oldManifestExists = false;
+
+            if (!CassandraRelevantProperties.SNAPSHOT_MANIFEST_ENRICH_OR_CREATE_ENABLED.getBoolean())
+                return;
+
+            // this is caused by not reading any manifest or that snapshot had a basic manifest just with sstables
+            // enumerated (pre CASSANDRA-16789), so we just go ahead and enrich it in each snapshot dir
+
+            if (createdAt != null)
+                return;
+
+            for (File snapshotDir : snapshotDirs)
+            {
+                File maybeManifest = new File(snapshotDir.toPath().resolve("manifest.json"));
+                if (maybeManifest.exists())
+                {
+                    oldManifestExists = true;
+                    break;
+                }
+            }
+
+            if (oldManifestExists)
+                logger.debug("Manifest in the old format for snapshot {} was detected, going to enrich it.", this);

Review Comment:
   Personally would prefer to see this logged at `info`. It happens very infrequently so its not a noise risk and its useful to know this is happening for the operator imo.



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