cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/3] git commit: Fix partition and range deletes not triggering flush
Date Wed, 05 Feb 2014 17:51:48 GMT
Updated Branches:
  refs/heads/trunk 58d1a4f81 -> fe4247e58


Fix partition and range deletes not triggering flush

patch by benedict; reviewed by slebresne for CASSANDRA-6655


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

Branch: refs/heads/trunk
Commit: adcb713d597302a868b6224a87ea6ce38e718e5d
Parents: 16efdf4
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Feb 5 18:34:37 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Feb 5 18:34:37 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                           |  3 +++
 .../org/apache/cassandra/db/AtomicSortedColumns.java  |  7 ++++++-
 src/java/org/apache/cassandra/db/DeletionInfo.java    | 14 ++++++++++++++
 src/java/org/apache/cassandra/db/Memtable.java        | 10 ++++++----
 4 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/adcb713d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0989dc4..cfdd148 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+1.2.16
+ * Fix partition and range deletes not triggering flush (CASSANDRA-6655)
+
 1.2.15
  * Move handling of migration event source to solve bootstrap race (CASSANDRA-6648)
  * Make sure compaction throughput value doesn't overflow with int math (CASSANDRA-6647)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/adcb713d/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
index 9803544..d6c861b 100644
--- a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
+++ b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
@@ -194,7 +194,12 @@ public class AtomicSortedColumns implements ISortedColumns
         {
             sizeDelta = 0;
             current = ref.get();
-            DeletionInfo newDelInfo = current.deletionInfo.copy().add(cm.getDeletionInfo());
+            DeletionInfo newDelInfo = current.deletionInfo;
+            if (cm.getDeletionInfo().mayModify(newDelInfo))
+            {
+                newDelInfo = current.deletionInfo.copy().add(cm.getDeletionInfo());
+                sizeDelta += newDelInfo.dataSize() - current.deletionInfo.dataSize();
+            }
             modified = new Holder(current.map.clone(), newDelInfo);
 
             for (IColumn column : cm.getSortedColumns())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/adcb713d/src/java/org/apache/cassandra/db/DeletionInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DeletionInfo.java b/src/java/org/apache/cassandra/db/DeletionInfo.java
index e486eeb..91af9fd 100644
--- a/src/java/org/apache/cassandra/db/DeletionInfo.java
+++ b/src/java/org/apache/cassandra/db/DeletionInfo.java
@@ -216,6 +216,20 @@ public class DeletionInfo
         return size + (ranges == null ? 0 : ranges.dataSize());
     }
 
+    public int rangeCount()
+    {
+        return ranges == null ? 0 : ranges.size();
+    }
+
+    /**
+     * Whether this deletion info may modify the provided one if added to it.
+     */
+    public boolean mayModify(DeletionInfo delInfo)
+    {
+        return topLevel.markedForDeleteAt > delInfo.topLevel.markedForDeleteAt
+            || ranges == null;
+    }
+
     @Override
     public String toString()
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/adcb713d/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 817561b..b229060 100644
--- a/src/java/org/apache/cassandra/db/Memtable.java
+++ b/src/java/org/apache/cassandra/db/Memtable.java
@@ -192,6 +192,7 @@ public class Memtable
     {
         ColumnFamily previous = columnFamilies.get(key);
 
+        long sizeDelta = 0;
         if (previous == null)
         {
             // AtomicSortedColumns doesn't work for super columns (see #3821)
@@ -199,14 +200,15 @@ public class Memtable
             // We'll add the columns later. This avoids wasting works if we get beaten in
the putIfAbsent
             previous = columnFamilies.putIfAbsent(new DecoratedKey(key.token, allocator.clone(key.key)),
empty);
             if (previous == null)
+            {
                 previous = empty;
+                sizeDelta += empty.deletionInfo().dataSize();
+            }
         }
 
-        long sizeDelta = previous.addAllWithSizeDelta(cf, allocator, localCopyFunction, indexer);
+        sizeDelta = previous.addAllWithSizeDelta(cf, allocator, localCopyFunction, indexer);
         currentSize.addAndGet(sizeDelta);
-        currentOperations.addAndGet((cf.getColumnCount() == 0)
-                                    ? cf.isMarkedForDelete() ? 1 : 0
-                                    : cf.getColumnCount());
+        currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 : 0)
+ cf.deletionInfo().rangeCount());
     }
 
     // for debugging


Mime
View raw message