This is an automated email from the ASF dual-hosted git repository. aleksey pushed a commit to branch cassandra-3.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-3.0 by this push: new ebfa280 Counters fail to increment in 2.1/2.2 to 3.X mixed version clusters ebfa280 is described below commit ebfa280fac2f43fb88e2e87d81f35b8017222a12 Author: Aleksey Yeshchenko <alek...@apple.com> AuthorDate: Fri Jan 11 17:58:35 2019 +0000 Counters fail to increment in 2.1/2.2 to 3.X mixed version clusters patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for CASSANDRA-14958 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/LegacyLayout.java | 4 ++-- .../org/apache/cassandra/db/context/CounterContext.java | 16 ++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 025d4b0..063e8fb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.18 + * Counters fail to increment in 2.1/2.2 to 3.X mixed version clusters (CASSANDRA-14958) * Streaming needs to synchronise access to LifecycleTransaction (CASSANDRA-14554) * Fix cassandra-stress write hang with default options (CASSANDRA-14616) * Differentiate between slices and RTs when decoding legacy bounds (CASSANDRA-14919) diff --git a/src/java/org/apache/cassandra/db/LegacyLayout.java b/src/java/org/apache/cassandra/db/LegacyLayout.java index 9600355..0044959 100644 --- a/src/java/org/apache/cassandra/db/LegacyLayout.java +++ b/src/java/org/apache/cassandra/db/LegacyLayout.java @@ -514,7 +514,7 @@ public abstract class LegacyLayout else if (cell.isCounterUpdate()) { out.writeLong(cell.timestamp); - long count = CounterContext.instance().getLocalCount(cell.value); + long count = CounterContext.instance().getUpdateCount(cell.value); ByteBufferUtil.writeWithLength(ByteBufferUtil.bytes(count), out); continue; } @@ -585,7 +585,7 @@ public abstract class LegacyLayout else if (cell.isCounterUpdate()) { size += TypeSizes.sizeof(cell.timestamp); - long count = CounterContext.instance().getLocalCount(cell.value); + long count = CounterContext.instance().getUpdateCount(cell.value); size += ByteBufferUtil.serializedSizeWithLength(ByteBufferUtil.bytes(count)); continue; } diff --git a/src/java/org/apache/cassandra/db/context/CounterContext.java b/src/java/org/apache/cassandra/db/context/CounterContext.java index b402464..d0952d0 100644 --- a/src/java/org/apache/cassandra/db/context/CounterContext.java +++ b/src/java/org/apache/cassandra/db/context/CounterContext.java @@ -137,6 +137,14 @@ public class CounterContext } /** + * Returns the count associated with the update counter id, or 0 if no such shard is present. + */ + public long getUpdateCount(ByteBuffer context) + { + return getClockAndCountOf(context, UPDATE_CLOCK_ID).count; + } + + /** * Creates a counter context with a single global, 2.1+ shard (a result of increment). */ public ByteBuffer createGlobal(CounterId id, long clock, long count) @@ -709,14 +717,6 @@ public class CounterContext } /** - * Returns the count associated with the local counter id, or 0 if no such shard is present. - */ - public long getLocalCount(ByteBuffer context) - { - return getLocalClockAndCount(context).count; - } - - /** * Returns the clock and the count associated with the given counter id, or (0, 0) if no such shard is present. */ @VisibleForTesting --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org