cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [11/11] git commit: dynamic HH page size
Date Wed, 04 Jan 2012 03:15:30 GMT
dynamic HH page size


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

Branch: refs/heads/3624
Commit: 8e528c8abfc2f62cb10fb8de21e1cb58f70d281e
Parents: 02346a1
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Dec 28 20:58:22 2011 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Dec 28 20:58:22 2011 -0600

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e528c8a/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 a028bdf..0ac93d8 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 >= behavr 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