jacek-lewandowski commented on code in PR #2065:
URL: https://github.com/apache/cassandra/pull/2065#discussion_r1065748563


##########
src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java:
##########
@@ -712,42 +712,57 @@ private UnfilteredRowIterator 
queryMemtableAndDiskInternal(ColumnFamilyStore cfs
                     break;
                 }
 
-                if (shouldInclude(sstable))
+                boolean intersects = intersects(sstable);
+                boolean hasRequiredStatics = hasRequiredStatics(sstable);
+                boolean hasPartitionLevelDeletions = 
hasPartitionLevelDeletions(sstable);
+
+                if (!intersects && !hasRequiredStatics && 
!hasPartitionLevelDeletions)
+                {
+                    nonIntersectingSSTables++;
+                    continue;
+                }
+
+                if (intersects || hasRequiredStatics)
                 {
                     if (!sstable.isRepaired())
                         
controller.updateMinOldestUnrepairedTombstone(sstable.getMinLocalDeletionTime());
 
                     // 'iter' is added to iterators which is closed on 
exception, or through the closing of the final merged iterator
                     @SuppressWarnings("resource")
-                    UnfilteredRowIteratorWithLowerBound iter = 
makeIterator(cfs, sstable, metricsCollector);
+                    UnfilteredRowIterator iter = intersects ? 
makeRowIteratorWithLowerBound(cfs, sstable, metricsCollector)
+                                                            : 
makeRowIteratorWithSkippedNonStaticContent(cfs, sstable, metricsCollector);
+
                     inputCollector.addSSTableIterator(sstable, iter);
                     mostRecentPartitionTombstone = 
Math.max(mostRecentPartitionTombstone,
                                                             
iter.partitionLevelDeletion().markedForDeleteAt());
                 }
                 else
                 {
                     nonIntersectingSSTables++;
-                    // sstable contains no tombstone if maxLocalDeletionTime 
== Integer.MAX_VALUE, so we can safely skip those entirely
-                    if (sstable.mayHaveTombstones())
+
+                    // if the sstable contained range or cell tombstones, it 
would intersect; since we are here, it means
+                    // that there are no cell or range tombstones we are 
interested in (due to the filter)
+                    // however, we know that there are partition level 
deletions in this sstable and we need to make
+                    // an iterator figure out that (see 
`StatsMetadata.hasPartitionLevelDeletions`)
+
+                    // 'iter' is added to iterators which is closed on 
exception, or through the closing of the final merged iterator
+                    @SuppressWarnings("resource")
+                    UnfilteredRowIterator iter = 
makeRowIteratorWithLowerBound(cfs, sstable, metricsCollector);

Review Comment:
   🤦🏻‍♂️ indeed
   



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