cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/3] git commit: Fix memtable flushing for indexed tables
Date Sun, 29 Sep 2013 23:29:32 GMT
Updated Branches:
  refs/heads/trunk 1d31d358d -> 70bfc8eb9


Fix memtable flushing for indexed tables

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-6112

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/db/compaction/CompactionManager.java


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

Branch: refs/heads/trunk
Commit: 898ce5f046fe2405a521f3128252d28ae9748f58
Parents: 8d3d67e
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Sep 30 02:17:51 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Sep 30 02:27:26 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                                  | 1 +
 src/java/org/apache/cassandra/db/Memtable.java               | 6 +++++-
 .../apache/cassandra/db/compaction/CompactionManager.java    | 2 +-
 .../org/apache/cassandra/db/index/SecondaryIndexManager.java | 8 ++++++++
 4 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/898ce5f0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 27ebc9b..ca559b1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,7 @@
  * Move batchlog replay to its own executor (CASSANDRA-6079)
  * Add tombstone debug threshold and histogram (CASSANDRA-6042, 6057)
  * Fix fat client schema pull NPE (CASSANDRA-6089)
+ * Fix memtable flushing for indexed tables (CASSANDRA-6112)
 
 
 1.2.10

http://git-wip-us.apache.org/repos/asf/cassandra/blob/898ce5f0/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 e39ccfe..1364030 100644
--- a/src/java/org/apache/cassandra/db/Memtable.java
+++ b/src/java/org/apache/cassandra/db/Memtable.java
@@ -423,7 +423,11 @@ public class Memtable
                         // But it can result in unexpected behaviour where deletes never
make it to disk,
                         // as they are lost and so cannot override existing column values.
So we only remove deleted columns if there
                         // is a CF level tombstone to ensure the delete makes it into an
SSTable.
-                        ColumnFamilyStore.removeDeletedColumnsOnly(cf, Integer.MIN_VALUE);
+                        // We also shouldn't be dropping any columns obsoleted by partition
and/or range tombstones in case
+                        // the table has secondary indexes, or else the stale entries wouldn't
be cleaned up during compaction,
+                        // and will only be dropped during 2i query read-repair, if at all.
+                        if (!cfs.indexManager.hasIndexes())
+                            ColumnFamilyStore.removeDeletedColumnsOnly(cf, Integer.MIN_VALUE);
                     }
                     writer.append((DecoratedKey)entry.getKey(), cf);
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/898ce5f0/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 5c17b0a..b34856e 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -558,7 +558,7 @@ public class CompactionManager implements CompactionManagerMBean
         }
 
         boolean isCommutative = cfs.metadata.getDefaultValidator().isCommutative();
-        boolean hasIndexes = !cfs.indexManager.getIndexes().isEmpty();
+        boolean hasIndexes = cfs.indexManager.hasIndexes();
 
         for (SSTableReader sstable : sstables)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/898ce5f0/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index 52d2152..9cbbe8f 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -401,6 +401,14 @@ public class SecondaryIndexManager
     }
 
     /**
+     * @return if there are ANY indexes for this table..
+     */
+    public boolean hasIndexes()
+    {
+        return !indexesByColumn.isEmpty();
+    }
+
+    /**
      * @return total current ram size of all indexes
      */
     public long getTotalLiveSize()


Mime
View raw message