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 sstable2json for CQL3 tables
Date Thu, 19 Sep 2013 10:00:06 GMT
Updated Branches:
  refs/heads/cassandra-1.2 eb390d02e -> 937536363


Fix sstable2json for CQL3 tables

patch by lyubent; reviewed by slebresne for CASSANDRA-5852


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

Branch: refs/heads/cassandra-1.2
Commit: a886e34909c313a1c3fa5dff48b77f1cee2c6847
Parents: eb390d0
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Sep 19 11:56:17 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Sep 19 11:56:17 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 src/java/org/apache/cassandra/config/CFMetaData.java | 15 ++++++++++++++-
 .../org/apache/cassandra/tools/SSTableImport.java    |  7 ++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a886e349/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c6e1169..f853cce 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix snapshots in use get deleted during snapshot repair (CASSANDRA-6011)
  * Move hints and exception count to o.a.c.metrics (CASSANDRA-6017)
  * Fix memory leak in snapshot repair (CASSANDRA-6047)
+ * Fix sstable2sjon for CQL3 tables (CASSANDRA-5852)
 
 
 1.2.9

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a886e349/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 33e3f00..4355737 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -995,7 +995,18 @@ public final class CFMetaData
             ByteBuffer[] components = composite.split(columnName);
             for (ColumnDefinition def : column_metadata.values())
             {
-                ByteBuffer toCompare = def.componentIndex == null ? columnName : components[def.componentIndex];
+                ByteBuffer toCompare;
+                if (def.componentIndex == null)
+                {
+                    toCompare = columnName;
+                }
+                else
+                {
+                    if (def.componentIndex >= components.length)
+                        break;
+
+                    toCompare = components[def.componentIndex];
+                }
                 if (def.name.equals(toCompare))
                     return def;
             }
@@ -1007,6 +1018,8 @@ public final class CFMetaData
         }
     }
 
+
+
     public ColumnDefinition getColumnDefinitionForIndex(String indexName)
     {
         for (ColumnDefinition def : column_metadata.values())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a886e349/src/java/org/apache/cassandra/tools/SSTableImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableImport.java b/src/java/org/apache/cassandra/tools/SSTableImport.java
index 71b1b60..68d4397 100644
--- a/src/java/org/apache/cassandra/tools/SSTableImport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableImport.java
@@ -156,7 +156,7 @@ public class SSTableImport
                 }
 
                 value = isDeleted() ? ByteBufferUtil.hexToBytes((String) fields.get(1))
-                                    : stringAsType((String) fields.get(1), meta.getValueValidator(name.duplicate()));
+                                    : stringAsType((String) fields.get(1), meta.getValueValidator(meta.getColumnDefinitionFromColumnName(name)));
             }
         }
 
@@ -245,6 +245,11 @@ public class SSTableImport
             {
                 cfamily.addAtom(new RangeTombstone(col.getName(), col.getValue(), col.timestamp,
col.localExpirationTime));
             }
+            // cql3 row marker, see CASSANDRA-5852
+            else if (!path.columnName.hasRemaining())
+            {
+                cfamily.addColumn(new QueryPath(cfm.cfName, superName, ByteBuffer.wrap(new
byte[3])), col.getValue(), col.timestamp);
+            }
             else
             {
                 cfamily.addColumn(path, col.getValue(), col.timestamp);


Mime
View raw message