Allow estimated memtable size to exceed slab allocator size patch by jbellis; reviewed by jasobrown for CASSANDRA-6078
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/16f19a7c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/16f19a7c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/16f19a7c Branch: refs/heads/cassandra-2.0 Commit: 16f19a7cce409da4e8ab9522c29450b17879e8d9 Parents: 5464853 Author: Jonathan Ellis <jbel...@apache.org> Authored: Tue Sep 24 20:46:45 2013 -0500 Committer: Jonathan Ellis <jbel...@apache.org> Committed: Tue Sep 24 20:46:45 2013 -0500 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/Memtable.java | 4 +--- src/java/org/apache/cassandra/utils/Allocator.java | 2 -- src/java/org/apache/cassandra/utils/HeapAllocator.java | 5 ----- src/java/org/apache/cassandra/utils/SlabAllocator.java | 8 -------- 5 files changed, 2 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/16f19a7c/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index a5903fa..6341e29 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 1.2.11 + * Allow estimated memtable size to exceed slab allocator size (CASSANDRA-6078) * Start MeteredFlusher earlier to prevent OOM during CL replay (CASSANDRA-6087) * Avoid sending Truncate command to fat clients (CASSANDRA-6088) * Allow cache-keys-to-save to be set at runtime (CASSANDRA-5980) http://git-wip-us.apache.org/repos/asf/cassandra/blob/16f19a7c/src/java/org/apache/cassandra/db/Memtable.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/Memtable.java b/src/java/org/apache/cassandra/db/Memtable.java index cbe20fe..e39ccfe 100644 --- a/src/java/org/apache/cassandra/db/Memtable.java +++ b/src/java/org/apache/cassandra/db/Memtable.java @@ -141,11 +141,9 @@ public class Memtable { long estimatedSize = (long) (currentSize.get() * cfs.liveRatio); - // cap the estimate at both ends by what the allocator can tell us + // liveRatio is just an estimate; we can get a lower bound directly from the allocator if (estimatedSize < allocator.getMinimumSize()) return allocator.getMinimumSize(); - if (estimatedSize > allocator.getMaximumSize()) - return allocator.getMaximumSize(); return estimatedSize; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/16f19a7c/src/java/org/apache/cassandra/utils/Allocator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/Allocator.java b/src/java/org/apache/cassandra/utils/Allocator.java index d11815d..7134353 100644 --- a/src/java/org/apache/cassandra/utils/Allocator.java +++ b/src/java/org/apache/cassandra/utils/Allocator.java @@ -38,6 +38,4 @@ public abstract class Allocator public abstract ByteBuffer allocate(int size); public abstract long getMinimumSize(); - - public abstract long getMaximumSize(); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/16f19a7c/src/java/org/apache/cassandra/utils/HeapAllocator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/HeapAllocator.java b/src/java/org/apache/cassandra/utils/HeapAllocator.java index efe55dd..3d19b98 100644 --- a/src/java/org/apache/cassandra/utils/HeapAllocator.java +++ b/src/java/org/apache/cassandra/utils/HeapAllocator.java @@ -38,9 +38,4 @@ public final class HeapAllocator extends Allocator { return 0; } - - public long getMaximumSize() - { - return Long.MAX_VALUE; - } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/16f19a7c/src/java/org/apache/cassandra/utils/SlabAllocator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/SlabAllocator.java b/src/java/org/apache/cassandra/utils/SlabAllocator.java index 6ff66f8..af38cde 100644 --- a/src/java/org/apache/cassandra/utils/SlabAllocator.java +++ b/src/java/org/apache/cassandra/utils/SlabAllocator.java @@ -117,14 +117,6 @@ public class SlabAllocator extends Allocator } /** - * @return an upper bound on how much space has been allocated - */ - public long getMaximumSize() - { - return unslabbed.get() + regionCount * (long)REGION_SIZE; - } - - /** * A region of memory out of which allocations are sliced. * * This serves two purposes: