Fix counter application order in short read protection

patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-12872


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9ea61305
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9ea61305
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9ea61305

Branch: refs/heads/trunk
Commit: 9ea61305ec30a476f48320c06f56d8d67000bbbe
Parents: 45218f9
Author: Aleksey Yeschenko <alek...@yeschenko.com>
Authored: Thu Sep 14 16:06:14 2017 +0100
Committer: Aleksey Yeschenko <alek...@yeschenko.com>
Committed: Fri Sep 15 17:24:26 2017 +0100

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 .../org/apache/cassandra/service/DataResolver.java    | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9ea61305/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dbee73e..a259545 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.15
+ * Fix counter application order in short read protection (CASSANDRA-12872)
  * Don't block RepairJob execution on validation futures (CASSANDRA-13797)
  * Wait for all management tasks to complete before shutting down CLSM 
(CASSANDRA-13123)
  * INSERT statement fails when Tuple type is used as clustering column with 
default DESC order (CASSANDRA-13717)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9ea61305/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 c59d688..580fd8b 100644
--- a/src/java/org/apache/cassandra/service/DataResolver.java
+++ b/src/java/org/apache/cassandra/service/DataResolver.java
@@ -473,11 +473,17 @@ public class DataResolver extends ResponseResolver
         @Override
         public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator 
partition)
         {
-            partition = Transformation.apply(partition, counter);
-            // must apply and extend with same protection instance
             ShortReadRowProtection protection = new 
ShortReadRowProtection(partition.metadata(), partition.partitionKey());
-            partition = MoreRows.extend(partition, protection);
-            partition = Transformation.apply(partition, protection); // apply 
after, so it is retained when we extend (in case we need to reextend)
+
+            partition = MoreRows.extend(partition, protection); // enable 
moreContents()
+
+            /*
+             * if we don't apply these transformations *after* extending the 
partition with MoreRows,
+             * their applyToRow() method will not be called on the first row 
of the new extension iterator
+             */
+            partition = Transformation.apply(partition, protection); // track 
lastClustering
+            partition = Transformation.apply(partition, counter);    // do the 
counting
+
             return partition;
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to