cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/3] cassandra git commit: ColumnIndex does not reuse buffer
Date Tue, 04 Oct 2016 11:32:34 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.X 2e18adf25 -> c2106e145
  refs/heads/trunk 723d055d8 -> 4ddd7b903


ColumnIndex does not reuse buffer

patch by Robert Stupp; reviewed by Branimir Lambov for CASSANDRA-12502


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

Branch: refs/heads/cassandra-3.X
Commit: c2106e1451e71b43d84b9938e9f2f1c1def8a7b8
Parents: 2e18adf
Author: Robert Stupp <snazy@snazy.de>
Authored: Tue Oct 4 13:28:06 2016 +0200
Committer: Robert Stupp <snazy@snazy-ds15.fritz.box>
Committed: Tue Oct 4 13:28:06 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 src/java/org/apache/cassandra/db/ColumnIndex.java | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c2106e14/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 25f02a2..af81195 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.10
+ * ColumnIndex does not reuse buffer (CASSANDRA-12502)
  * cdc column addition still breaks schema migration tasks (CASSANDRA-12697)
  * Upgrade metrics-reporter dependencies (CASSANDRA-12089)
  * Tune compaction thread count via nodetool (CASSANDRA-12248)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c2106e14/src/java/org/apache/cassandra/db/ColumnIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnIndex.java b/src/java/org/apache/cassandra/db/ColumnIndex.java
index 1f39927..8ea1272 100644
--- a/src/java/org/apache/cassandra/db/ColumnIndex.java
+++ b/src/java/org/apache/cassandra/db/ColumnIndex.java
@@ -200,7 +200,7 @@ public class ColumnIndex
             indexSamplesSerializedSize += idxSerializer.serializedSize(cIndexInfo);
             if (indexSamplesSerializedSize + columnIndexCount * TypeSizes.sizeof(0) >
DatabaseDescriptor.getColumnIndexCacheSize())
             {
-                buffer = useBuffer();
+                buffer = reuseOrAllocateBuffer();
                 for (IndexInfo indexSample : indexSamples)
                 {
                     idxSerializer.serialize(indexSample, buffer);
@@ -220,12 +220,14 @@ public class ColumnIndex
         firstClustering = null;
     }
 
-    private DataOutputBuffer useBuffer()
+    private DataOutputBuffer reuseOrAllocateBuffer()
     {
-        if (reusableBuffer != null) 
-        {
-            buffer = reusableBuffer;
+        // Check whether a reusable DataOutputBuffer already exists for this
+        // ColumnIndex instance and return it.
+        if (reusableBuffer != null) {
+            DataOutputBuffer buffer = reusableBuffer;
             buffer.clear();
+            return buffer;
         }
         // don't use the standard RECYCLER as that only recycles up to 1MB and requires proper
cleanup
         return new DataOutputBuffer(DatabaseDescriptor.getColumnIndexCacheSize() * 2);


Mime
View raw message