maedhroz commented on code in PR #2420:
URL: https://github.com/apache/cassandra/pull/2420#discussion_r1235814413


##########
src/java/org/apache/cassandra/db/streaming/ComponentManifest.java:
##########
@@ -52,13 +53,17 @@ public ComponentManifest(Map<Component, Long> components)
     }
 
     @VisibleForTesting
-    public static ComponentManifest create(Descriptor descriptor)
+    public static ComponentManifest create(SSTable sstable)
     {
-        LinkedHashMap<Component, Long> components = new 
LinkedHashMap<>(descriptor.getFormat().streamingComponents().size());
+        Set<Component> streamingComponents = sstable.getComponents();
+        LinkedHashMap<Component, Long> components = new 
LinkedHashMap<>(streamingComponents.size());
 
-        for (Component component : 
descriptor.getFormat().streamingComponents())
+        for (Component component : streamingComponents)
         {
-            File file = descriptor.fileFor(component);
+            if (component == SSTableFormat.Components.TOC)

Review Comment:
   We could also hide this in `SSTable` with a `getStreamingComponents()` and 
leave this logic in the manifest almost unchanged? It already makes a copy of 
`components`, and this isn't really a hot path anyway, so filtering there w/ 
something like...
   
   ```
   public Set<Component> getStreamingComponents()
   {
       return components.stream()
                        .filter(c -> 
descriptor.getFormat().streamingComponents().contains(c) || c.type == 
Components.Types.SAI)
                        .collect(Collectors.toSet());
   }
   ```



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