cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdeggles...@apache.org
Subject [1/2] cassandra git commit: Fix digest calculation for counter cells
Date Thu, 10 Aug 2017 22:52:18 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.11 303dba650 -> e018bec8a


Fix digest calculation for counter cells

Patch by Blake Eggleston; reviewed by Aleksey Yeschenko for CASSANDRA-13750


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

Branch: refs/heads/cassandra-3.11
Commit: eb6f03c8928e913cb6f9eaa7c9ea9f4501039112
Parents: 1a70ded
Author: Blake Eggleston <bdeggleston@gmail.com>
Authored: Tue Aug 8 13:45:41 2017 -0700
Committer: Blake Eggleston <bdeggleston@gmail.com>
Committed: Thu Aug 10 15:42:31 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/db/rows/AbstractCell.java | 10 +++++++++-
 test/unit/org/apache/cassandra/db/CounterCellTest.java  |  4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb6f03c8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1f42c70..0b92a7e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.15
+ * Fix digest calculation for counter cells (CASSANDRA-13750)
  * Fix ColumnDefinition.cellValueType() for non-frozen collection and change SSTabledump
to use type.toJSONString() (CASSANDRA-13573)
  * Skip materialized view addition if the base table doesn't exist (CASSANDRA-13737)
  * Drop table should remove corresponding entries in dropped_columns table (CASSANDRA-13730)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb6f03c8/src/java/org/apache/cassandra/db/rows/AbstractCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/AbstractCell.java b/src/java/org/apache/cassandra/db/rows/AbstractCell.java
index 7e93c2e..576351e 100644
--- a/src/java/org/apache/cassandra/db/rows/AbstractCell.java
+++ b/src/java/org/apache/cassandra/db/rows/AbstractCell.java
@@ -42,7 +42,15 @@ public abstract class AbstractCell extends Cell
 
     public void digest(MessageDigest digest)
     {
-        digest.update(value().duplicate());
+        if (isCounterCell())
+        {
+            CounterContext.instance().updateDigest(digest, value());
+        }
+        else
+        {
+            digest.update(value().duplicate());
+        }
+
         FBUtilities.updateWithLong(digest, timestamp());
         FBUtilities.updateWithInt(digest, ttl());
         FBUtilities.updateWithBoolean(digest, isCounterCell());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb6f03c8/test/unit/org/apache/cassandra/db/CounterCellTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CounterCellTest.java b/test/unit/org/apache/cassandra/db/CounterCellTest.java
index 08e0b25..a8ddfcc 100644
--- a/test/unit/org/apache/cassandra/db/CounterCellTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterCellTest.java
@@ -276,8 +276,8 @@ public class CounterCellTest
         ColumnDefinition cDef = cfs.metadata.getColumnDefinition(col);
         Cell cleared = BufferCell.live(cfs.metadata, cDef, 5, CounterContext.instance().clearAllLocal(state.context));
 
-        CounterContext.instance().updateDigest(digest1, original.value());
-        CounterContext.instance().updateDigest(digest2, cleared.value());
+        original.digest(digest1);
+        cleared.digest(digest2);
 
         assert Arrays.equals(digest1.digest(), digest2.digest());
     }


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


Mime
View raw message