cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix commit for #3792
Date Tue, 13 Mar 2012 14:17:28 GMT
Updated Branches:
  refs/heads/cassandra-1.1.0 ccb002893 -> 23dd8c968


Fix commit for #3792


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

Branch: refs/heads/cassandra-1.1.0
Commit: 23dd8c96823d29d92c181f4e3be44002e01811b6
Parents: ccb0028
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Mar 13 15:16:58 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Mar 13 15:17:14 2012 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/config/CFMetaData.java    |   26 +++++++++++---
 1 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/23dd8c96/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 8198f76..bebd9f6 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -714,7 +714,7 @@ public final class CFMetaData
         {
             ColumnDefinition oldDef = column_metadata.get(name);
             ColumnDefinition def = cfm.column_metadata.get(name);
-            oldDef.apply(def, comparator);
+            oldDef.apply(def, getColumnDefinitionComparator());
         }
 
         compactionStrategyClass = cfm.compactionStrategyClass;
@@ -902,17 +902,17 @@ public final class CFMetaData
 
         // columns that are no longer needed
         for (ColumnDefinition cd : columnDiff.entriesOnlyOnLeft().values())
-            cd.deleteFromSchema(rm, cfName, comparator, modificationTimestamp);
+            cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
 
         // newly added columns
         for (ColumnDefinition cd : columnDiff.entriesOnlyOnRight().values())
-            cd.toSchema(rm, cfName, comparator, modificationTimestamp);
+            cd.toSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
 
         // old columns with updated attributes
         for (ByteBuffer name : columnDiff.entriesDiffering().keySet())
         {
             ColumnDefinition cd = newState.getColumnDefinition(name);
-            cd.toSchema(rm, cfName, comparator, modificationTimestamp);
+            cd.toSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
         }
 
         return rm;
@@ -954,7 +954,7 @@ public final class CFMetaData
         cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "compaction_strategy_options"));
 
         for (ColumnDefinition cd : column_metadata.values())
-            cd.deleteFromSchema(rm, cfName, comparator, timestamp);
+            cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(), timestamp);
 
         return rm;
     }
@@ -964,7 +964,7 @@ public final class CFMetaData
         toSchemaNoColumns(rm, timestamp);
 
         for (ColumnDefinition cd : column_metadata.values())
-            cd.toSchema(rm, cfName, comparator, timestamp);
+            cd.toSchema(rm, cfName, getColumnDefinitionComparator(), timestamp);
     }
 
     private void toSchemaNoColumns(RowMutation rm, long timestamp)
@@ -1113,6 +1113,20 @@ public final class CFMetaData
         }
     }
 
+    public AbstractType<?> getColumnDefinitionComparator()
+    {
+        AbstractType<?> cfComparator = cfType == ColumnFamilyType.Super ? subcolumnComparator
: comparator;
+        if (cfComparator instanceof CompositeType)
+        {
+            List<AbstractType<?>> types = ((CompositeType)cfComparator).types;
+            return types.get(types.size() - 1);
+        }
+        else
+        {
+            return cfComparator;
+        }
+    }
+
     // Package protected for use by tests
     static CFMetaData addColumnDefinitionSchema(CFMetaData cfDef, Row serializedColumnDefinitions)
     {


Mime
View raw message