Updated Branches: refs/heads/cassandra-2.0 66df206d8 -> 00a68398f
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/cassandra-2.0 Commit: eb577459df33ef2fd0b19c4eb567b4d0395575d6 Parents: e5715f4 Author: Aleksey Yeschenko <[email protected]> Authored: Fri Nov 8 00:53:27 2013 +0300 Committer: Aleksey Yeschenko <[email protected]> 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"); }
