cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] git commit: Have secondary indexes inherit compression and compaction properties from parent CF
Date Mon, 13 Feb 2012 11:27:17 GMT
Have secondary indexes inherit compression and compaction properties from parent CF

patch by slebresne; reviewed by xedin for CASSANDRA-3877


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

Branch: refs/heads/trunk
Commit: 6a6bf3cf1aac6099c38c50b8d9d46f4ddea5a323
Parents: 5f5e00b
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Feb 9 16:11:57 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Feb 13 12:22:40 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    5 +++++
 .../org/apache/cassandra/config/CFMetaData.java    |   15 ++++++++++++---
 .../cassandra/db/index/SecondaryIndexManager.java  |    6 ++++++
 3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a6bf3cf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5d9eaf9..e115a2a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -71,6 +71,11 @@
  * CQL support for altering key_validation_class in ALTER TABLE (CASSANDRA-3781)
  * turn compression on by default (CASSANDRA-3871)
  * make hexToBytes refuse invalid input (CASSANDRA-2851)
+ * Make secondary indexes CF inherit compression and compaction from their
+   parent CF (CASSANDRA-3877)
+Merged from 1.0:
+ * Only snapshot CF being compacted for snapshot_before_compaction
+   (CASSANDRA-3803)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a6bf3cf/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index defa6cf..06b1adf 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -279,9 +279,18 @@ public final class CFMetaData
                              .keyValidator(info.getValidator())
                              .readRepairChance(0.0)
                              .dclocalReadRepairChance(0.0)
-                             .gcGraceSeconds(parent.gcGraceSeconds)
-                             .minCompactionThreshold(parent.minCompactionThreshold)
-                             .maxCompactionThreshold(parent.maxCompactionThreshold);
+                             .reloadSecondaryIndexMetadata(parent);
+    }
+
+    public CFMetaData reloadSecondaryIndexMetadata(CFMetaData parent)
+    {
+        gcGraceSeconds(parent.gcGraceSeconds);
+        minCompactionThreshold(parent.minCompactionThreshold);
+        maxCompactionThreshold(parent.maxCompactionThreshold);
+        compactionStrategyClass(parent.compactionStrategyClass);
+        compactionStrategyOptions(parent.compactionStrategyOptions);
+        compressionParameters(parent.compressionParameters);;
+        return this;
     }
 
     // Create a new CFMD by changing just the cfName

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a6bf3cf/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 3758e9b..aa16db2 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -93,6 +93,12 @@ public class SecondaryIndexManager
         for (ColumnDefinition cdef : baseCfs.metadata.getColumn_metadata().values())
             if (cdef.getIndexType() != null && !indexedColumnNames.contains(cdef.name))
                 addIndexedColumn(cdef);
+
+        for (ColumnFamilyStore cfs : getIndexesBackedByCfs())
+        {
+            cfs.metadata.reloadSecondaryIndexMetadata(baseCfs.metadata);
+            cfs.reload();
+        }
     }
     
     


Mime
View raw message