adelapena commented on code in PR #2492:
URL: https://github.com/apache/cassandra/pull/2492#discussion_r1266879726


##########
src/java/org/apache/cassandra/index/SecondaryIndexManager.java:
##########
@@ -491,9 +497,108 @@ public static String getIndexName(String cfName)
         return StringUtils.substringAfter(cfName, 
Directories.SECONDARY_INDEX_NAME_SEPARATOR);
     }
 
+    // TODO: JavaDoc if this approach survives...mention that this should not 
be used for live SSTables
+    public boolean validateStorageAttachedIndexes(Collection<SSTableReader> 
sstables, boolean failIncomplete) throws IOException
+    {
+        // TODO: A more generic approach via the Index interface rather than 
just working w/ SAI 
+        Set<StorageAttachedIndex> toValidate = 
indexes.values().stream().filter(i -> i instanceof StorageAttachedIndex)
+                                                                        .map(i 
-> (StorageAttachedIndex) i)
+                                                                        
.collect(Collectors.toSet());
+
+        if (toValidate.isEmpty())
+            return true;
+        
+        boolean complete = true;
+
+        for (SSTableReader sstable : sstables)
+        {
+            IndexDescriptor indexDescriptor = IndexDescriptor.create(sstable);
+
+            if (indexDescriptor.isPerSSTableIndexBuildComplete())
+            {
+                indexDescriptor.checksumPerSSTableComponents();

Review Comment:
   Couldn't this use 
`indexDescriptor#validatePerSSTableComponents(IndexValidation.CHECKSUM)`, so we 
don't need the special `IndexDescriptor#checksumPerSSTableComponents` method? 
And the same for per index components.



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