cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: dynamic HH page size patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3624
Date Wed, 04 Jan 2012 16:03:59 GMT
Updated Branches:
  refs/heads/trunk 9a76e646e -> 7043e2953


dynamic HH page size
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3624


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

Branch: refs/heads/trunk
Commit: 7043e2953fd1d2fc9f23acf26e3376d6d0cb1f7a
Parents: 9a76e64
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Dec 28 20:58:22 2011 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Jan 4 10:01:46 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/db/HintedHandOffManager.java  |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7043e295/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 798fde7..64b0800 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.1-dev
+ * fix regression in HH page size calculation (CASSANDRA-3624)
  * avoid returning internal Cassandra classes over JMX (CASSANDRA-2805)
  * add row-level isolation via SnapTree (CASSANDRA-2893)
  * Optimize key count estimation when opening sstable on startup

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7043e295/src/java/org/apache/cassandra/db/HintedHandOffManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
index 272d415..fe418ae 100644
--- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java
+++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
@@ -87,7 +87,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
     public static final String HINTS_CF = "HintsColumnFamily";
 
     private static final Logger logger_ = LoggerFactory.getLogger(HintedHandOffManager.class);
-    private static final int PAGE_SIZE = 1024;
+    private static final int PAGE_SIZE = 128;
     private static final int LARGE_NUMBER = 65536; // 64k nodes ought to be enough for anybody.
 
     // in 0.8, subcolumns were KS-CF bytestrings, and the data was stored in the "normal"
storage there.
@@ -270,10 +270,20 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
         int rowsReplayed = 0;
         ByteBuffer startColumn = ByteBufferUtil.EMPTY_BYTE_BUFFER;
 
+        int pageSize = PAGE_SIZE;
+        // read less columns (mutations) per page if they are very large
+        if (hintStore.getMeanColumns() > 0)
+        {
+            int averageColumnSize = (int) (hintStore.getMeanRowSize() / hintStore.getMeanColumns());
+            pageSize = Math.min(PAGE_SIZE, DatabaseDescriptor.getInMemoryCompactionLimit()
/ averageColumnSize);
+            pageSize = Math.max(2, pageSize); // page size of 1 does not allow actual paging
b/c of >= behavior on startColumn
+            logger_.debug("average hinted-row column size is {}; using pageSize of {}", averageColumnSize,
pageSize);
+        }
+
         delivery:
         while (true)
         {
-            QueryFilter filter = QueryFilter.getSliceFilter(epkey, new QueryPath(HINTS_CF),
startColumn, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, PAGE_SIZE);
+            QueryFilter filter = QueryFilter.getSliceFilter(epkey, new QueryPath(HINTS_CF),
startColumn, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, pageSize);
             ColumnFamily hintsPage = ColumnFamilyStore.removeDeleted(hintStore.getColumnFamily(filter),
Integer.MAX_VALUE);
             if (pagingFinished(hintsPage, startColumn))
                 break;


Mime
View raw message