cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [01/13] cassandra git commit: LocalToken ensures object buffer is on heap
Date Tue, 29 Nov 2016 17:24:01 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 7dd609c8f -> 820e7a8d8
  refs/heads/cassandra-3.11 2b65b0d8b -> d5dbd0c75
  refs/heads/cassandra-3.X bf97b8507 -> 40043021b
  refs/heads/trunk b7ccd518c -> 50b8be4e7


LocalToken ensures object buffer is on heap

Patch by Sam Tunnicliffe; reviewed by Alex Petrov for CASSANDRA-12651


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

Branch: refs/heads/cassandra-3.0
Commit: 820e7a8d810828d29f98a68dc35be33b40a5de62
Parents: 7dd609c
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Thu Nov 17 16:42:19 2016 +0000
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Tue Nov 29 16:56:37 2016 +0000

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/dht/LocalPartitioner.java | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/820e7a8d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a2c552e..b77d84a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.11
+ * LocalToken ensures token values are cloned on heap (CASSANDRA-12651)
  * AnticompactionRequestSerializer serializedSize is incorrect (CASSANDRA-12934)
  * Prevent reloading of logback.xml from UDF sandbox (CASSANDRA-12535)
 Merged from 2.2:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/820e7a8d/src/java/org/apache/cassandra/dht/LocalPartitioner.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/LocalPartitioner.java b/src/java/org/apache/cassandra/dht/LocalPartitioner.java
index f9421c5..aaf2569 100644
--- a/src/java/org/apache/cassandra/dht/LocalPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/LocalPartitioner.java
@@ -27,10 +27,11 @@ import org.apache.cassandra.db.CachedHashDecoratedKey;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.ObjectSizes;
+import org.apache.cassandra.utils.memory.HeapAllocator;
 
 public class LocalPartitioner implements IPartitioner
 {
-    private static final long EMPTY_SIZE = ObjectSizes.measure(new LocalPartitioner(null).new
LocalToken(null));
+    private static final long EMPTY_SIZE = ObjectSizes.measure(new LocalPartitioner(null).new
LocalToken());
 
     final AbstractType<?> comparator;   // package-private to avoid access workarounds
in embedded LocalToken.
 
@@ -121,9 +122,14 @@ public class LocalPartitioner implements IPartitioner
     {
         static final long serialVersionUID = 8437543776403014875L;
 
+        private LocalToken()
+        {
+            super(null);
+        }
+
         public LocalToken(ByteBuffer token)
         {
-            super(token);
+            super(HeapAllocator.instance.clone(token));
         }
 
         @Override


Mime
View raw message