Fix short read protection for tables with no clustering columns patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for CASSANDRA-13880
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/35e32f20 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/35e32f20 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/35e32f20 Branch: refs/heads/trunk Commit: 35e32f20ba8cba6cbfb1bee4252c0edd8684cdb1 Parents: bb3b332 Author: Aleksey Yeschenko <alek...@yeschenko.com> Authored: Mon Sep 18 14:01:19 2017 +0100 Committer: Aleksey Yeschenko <alek...@yeschenko.com> Committed: Mon Sep 18 16:13:43 2017 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/service/DataResolver.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/35e32f20/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 84ef845..74e70e1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.15 + * Fix short read protection for tables with no clustering columns (CASSANDRA-13880) * Make isBuilt volatile in PartitionUpdate (CASSANDRA-13619) * Prevent integer overflow of timestamps in CellTest and RowsTest (CASSANDRA-13866) * Fix counter application order in short read protection (CASSANDRA-12872) http://git-wip-us.apache.org/repos/asf/cassandra/blob/35e32f20/src/java/org/apache/cassandra/service/DataResolver.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/DataResolver.java b/src/java/org/apache/cassandra/service/DataResolver.java index 580fd8b..99399a3 100644 --- a/src/java/org/apache/cassandra/service/DataResolver.java +++ b/src/java/org/apache/cassandra/service/DataResolver.java @@ -510,6 +510,8 @@ public class DataResolver extends ResponseResolver @Override public UnfilteredRowIterator moreContents() { + assert !postReconciliationCounter.isDoneForPartition(); + // We have a short read if the node this is the result of has returned the requested number of // rows for that partition (i.e. it has stopped returning results due to the limit), but some of // those results haven't made it in the final result post-reconciliation due to other nodes @@ -522,9 +524,13 @@ public class DataResolver extends ResponseResolver // skipped during reconciliation. if (lastCount == counter.counted() || !counter.isDoneForPartition()) return null; - lastCount = counter.counted(); - assert !postReconciliationCounter.isDoneForPartition(); + // clustering of the last row returned is empty, meaning that there is only one row per partition, + // and we already have it. + if (lastClustering == Clustering.EMPTY) + return null; + + lastCount = counter.counted(); // We need to try to query enough additional results to fulfill our query, but because we could still // get short reads on that additional query, just querying the number of results we miss may not be --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org