cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/2] git commit: Fix updating column_metadata from thrift
Date Fri, 25 Oct 2013 17:11:31 GMT
Updated Branches:
  refs/heads/trunk 0dccea4f3 -> 0c56a5ece


Fix updating column_metadata from thrift

patch by slebresne; reviewed by jbellis for CASSANDRA-6182


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

Branch: refs/heads/trunk
Commit: 2c4b043f94d4fa4b35e60949be5e298f1efe6422
Parents: 2f248b3
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Oct 25 19:10:07 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Oct 25 19:10:07 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                | 4 ++++
 src/java/org/apache/cassandra/config/CFMetaData.java       | 4 ++--
 src/java/org/apache/cassandra/config/ColumnDefinition.java | 6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2c4b043f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 32c74aa..3c96770 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+2.0.3
+ * Fix modifying column_metadata from thrift (CASSANDRA-6182)
+
+
 2.0.2
  * Update FailureDetector to use nanontime (CASSANDRA-4925)
  * Fix FileCacheService regressions (CASSANDRA-6149)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2c4b043f/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 d63ee01..20c35b3 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -1461,7 +1461,7 @@ public final class CFMetaData
             if (fromThrift && cd.type != ColumnDefinition.Type.REGULAR)
                 continue;
 
-            cd.deleteFromSchema(rm, cfName, modificationTimestamp);
+            cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), modificationTimestamp);
         }
 
         // newly added columns
@@ -1506,7 +1506,7 @@ public final class CFMetaData
         cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp,
ldt));
 
         for (ColumnDefinition cd : column_metadata.values())
-            cd.deleteFromSchema(rm, cfName, timestamp);
+            cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp);
 
         for (TriggerDefinition td : triggers.values())
             td.deleteFromSchema(rm, cfName, timestamp);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2c4b043f/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index d68e7e2..7ca4d45 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -230,13 +230,15 @@ public class ColumnDefinition
      * @param cfName     The name of the parent ColumnFamily
      * @param timestamp  The timestamp to use for column modification
      */
-    public void deleteFromSchema(RowMutation rm, String cfName, long timestamp)
+    public void deleteFromSchema(RowMutation rm, String cfName, AbstractType<?> comparator,
long timestamp)
     {
         ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaColumnsCf);
         int ldt = (int) (System.currentTimeMillis() / 1000);
 
         ColumnNameBuilder builder = CFMetaData.SchemaColumnsCf.getCfDef().getColumnNameBuilder();
-        builder.add(ByteBufferUtil.bytes(cfName)).add(name);
+        // Note: the following is necessary for backward compatibility. For CQL3, comparator
will be UTF8 and nameBytes == name
+        ByteBuffer nameBytes = ByteBufferUtil.bytes(comparator.getString(name));
+        builder.add(ByteBufferUtil.bytes(cfName)).add(nameBytes);
         cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp,
ldt));
     }
 


Mime
View raw message