cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/3] git commit: Fix counter header length shortcut logic
Date Thu, 07 Nov 2013 21:55:34 GMT
Updated Branches:
  refs/heads/trunk f01166a53 -> 26307f96c


Fix counter header length shortcut logic


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

Branch: refs/heads/trunk
Commit: eb577459df33ef2fd0b19c4eb567b4d0395575d6
Parents: e5715f4
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Fri Nov 8 00:53:27 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Fri Nov 8 00:53:27 2013 +0300

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/context/CounterContext.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb577459/src/java/org/apache/cassandra/db/context/CounterContext.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/context/CounterContext.java b/src/java/org/apache/cassandra/db/context/CounterContext.java
index 9e309f9..a892c8c 100644
--- a/src/java/org/apache/cassandra/db/context/CounterContext.java
+++ b/src/java/org/apache/cassandra/db/context/CounterContext.java
@@ -492,7 +492,7 @@ public class CounterContext implements IContext
     public ByteBuffer markDeltaToBeCleared(ByteBuffer context)
     {
         int headerLength = headerLength(context);
-        if (headerLength == 0)
+        if (headerLength == HEADER_SIZE_LENGTH)
             return context;
 
         ByteBuffer marked = context.duplicate();
@@ -512,7 +512,7 @@ public class CounterContext implements IContext
     public ByteBuffer clearAllDelta(ByteBuffer context)
     {
         int headerLength = headerLength(context);
-        if (headerLength == 0)
+        if (headerLength == HEADER_SIZE_LENGTH)
             return context;
 
         ByteBuffer cleaned = ByteBuffer.allocate(context.remaining() - headerLength + HEADER_SIZE_LENGTH);
@@ -528,8 +528,7 @@ public class CounterContext implements IContext
 
     public void validateContext(ByteBuffer context) throws MarshalException
     {
-        int headerLength = headerLength(context);
-        if (headerLength < 0 || (context.remaining() - headerLength) %  STEP_LENGTH !=
0)
+        if ((context.remaining() - headerLength(context)) % STEP_LENGTH != 0)
             throw new MarshalException("Invalid size for a counter context");
     }
 


Mime
View raw message