Fix partition-level-delete-only workload accounting patch by benedict; reviewed by jbellis for CASSANDRA-9194
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f0c7a6f0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f0c7a6f0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f0c7a6f0 Branch: refs/heads/trunk Commit: f0c7a6f03cf55ddcfe11a58c80087ed8b0806cf4 Parents: 593a725 Author: Benedict Elliott Smith <bened...@apache.org> Authored: Fri May 1 11:32:31 2015 +0100 Committer: Benedict Elliott Smith <bened...@apache.org> Committed: Fri May 1 11:32:31 2015 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/Memtable.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0c7a6f0/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 4e7a5d0..dfdad51 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.0.15: + * Fix partition-level-delete-only workload accounting (CASSANDRA-9194) * Allow scrub to handle corrupted compressed chunks (CASSANDRA-9140) * Fix assertion error when resetlocalschema is run during repair (CASSANDRA-9249) * Disable single sstable tombstone compactions for DTCS by default (CASSANDRA-9234) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0c7a6f0/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 19f38be..897d94e 100644 --- a/src/java/org/apache/cassandra/db/Memtable.java +++ b/src/java/org/apache/cassandra/db/Memtable.java @@ -206,17 +206,21 @@ public class Memtable { AtomicSortedColumns previous = rows.get(key); + long initialSize = 0; if (previous == null) { AtomicSortedColumns empty = cf.cloneMeShallow(AtomicSortedColumns.factory, false); // We'll add the columns later. This avoids wasting works if we get beaten in the putIfAbsent previous = rows.putIfAbsent(new DecoratedKey(key.token, allocator.clone(key.key)), empty); if (previous == null) + { previous = empty; + initialSize += 1; + } } final Pair<Long, Long> pair = previous.addAllWithSizeDelta(cf, allocator, localCopyFunction, indexer); - currentSize.addAndGet(pair.left); + currentSize.addAndGet(initialSize + pair.left); currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 : 0) + cf.deletionInfo().rangeCount()); return pair.right; }