maedhroz commented on code in PR #3916: URL: https://github.com/apache/cassandra/pull/3916#discussion_r1968021601
########## src/java/org/apache/cassandra/service/reads/ReplicaFilteringProtection.java: ########## @@ -538,14 +538,19 @@ private UnfilteredPartitionIterator fetchFromSource() Tracing.trace("Requesting {} rows in partition {} from {} for replica filtering protection", clusterings.size(), key, source); - // build the read command taking into account that we could be requesting only in the static row - DataLimits limits = clusterings.isEmpty() ? DataLimits.cqlLimits(1) : DataLimits.NONE; - ClusteringIndexFilter filter = unresolvedStatic ? command.clusteringIndexFilter(key) : new ClusteringIndexNamesFilter(clusterings, command.isReversed()); + // If there is an unresolved static column, we must fetch the entire partition, as static column predicates + // may produce row matches across the entire partition. If there are only non-static rows to complete, we + // query the partition specifically for the corresponding cluterings by name. In either case, we do not + // provide a limit. (In the unresolved static case, we have no way of knowing how many stale rows we might + // read on a silent replica before finding a live one.) + ClusteringIndexFilter filter = unresolvedStatic ? command.clusteringIndexFilter(key) + : new ClusteringIndexNamesFilter(clusterings, command.isReversed()); Review Comment: The only way I can imagine improving this is perhaps paging so that we don't fetch every row from a very large partition at once. Not 100% sure how to do that yet, but looking around the code to try to find some example of doing this w/ an `UnfilteredPartitionIterator` -- 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-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org