cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [4/6] cassandra git commit: Merge commit '7c2437e26bc289c0a4c40fca303310fb61f362b1' into cassandra-3.11
Date Wed, 08 Feb 2017 10:42:56 GMT
Merge commit '7c2437e26bc289c0a4c40fca303310fb61f362b1' into cassandra-3.11

* commit '7c2437e26bc289c0a4c40fca303310fb61f362b1':
  Duplicate rows after upgrading from 2.1.16 to 3.0.10/3.9


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

Branch: refs/heads/trunk
Commit: 6b7302b6594c9a248989a1b5b64308421d67bc9f
Parents: 3acdcaf 7c2437e
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Feb 8 11:37:33 2017 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Feb 8 11:41:33 2017 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/db/LegacyLayout.java   | 62 ++++++++++++++---
 .../apache/cassandra/db/LegacyLayoutTest.java   | 73 ++++++++++++++++++++
 2 files changed, 124 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b7302b6/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b7302b6/test/unit/org/apache/cassandra/db/LegacyLayoutTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/LegacyLayoutTest.java
index 0000000,09e9755..6103727
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/db/LegacyLayoutTest.java
+++ b/test/unit/org/apache/cassandra/db/LegacyLayoutTest.java
@@@ -1,0 -1,71 +1,73 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
+ package org.apache.cassandra.db;
+ 
+ import java.nio.ByteBuffer;
+ 
+ import org.junit.Test;
+ 
+ import org.apache.cassandra.config.CFMetaData;
+ import org.apache.cassandra.config.ColumnDefinition;
+ import org.apache.cassandra.cql3.ColumnIdentifier;
+ import org.apache.cassandra.db.marshal.Int32Type;
+ import org.apache.cassandra.db.marshal.SetType;
+ import org.apache.cassandra.db.partitions.PartitionUpdate;
+ import org.apache.cassandra.db.rows.BTreeRow;
+ import org.apache.cassandra.db.rows.Row;
++import org.apache.cassandra.dht.Murmur3Partitioner;
+ import org.apache.cassandra.utils.ByteBufferUtil;
+ 
+ import static org.junit.Assert.*;
+ 
+ public class LegacyLayoutTest
+ {
+     @Test
+     public void testFromUnfilteredRowIterator() throws Throwable
+     {
+         CFMetaData table = CFMetaData.Builder.create("ks", "table")
++                                             .withPartitioner(Murmur3Partitioner.instance)
+                                              .addPartitionKey("k", Int32Type.instance)
+                                              .addRegularColumn("a", SetType.getInstance(Int32Type.instance,
true))
+                                              .addRegularColumn("b", SetType.getInstance(Int32Type.instance,
true))
+                                              .build();
+ 
+         ColumnDefinition a = table.getColumnDefinition(new ColumnIdentifier("a", false));
+         ColumnDefinition b = table.getColumnDefinition(new ColumnIdentifier("b", false));
+ 
+         Row.Builder builder = BTreeRow.unsortedBuilder(0);
+         builder.newRow(Clustering.EMPTY);
+         builder.addComplexDeletion(a, new DeletionTime(1L, 1));
+         builder.addComplexDeletion(b, new DeletionTime(1L, 1));
+         Row row = builder.build();
+ 
+         ByteBuffer key = ByteBufferUtil.bytes(1);
+         PartitionUpdate upd = PartitionUpdate.singleRowUpdate(table, key, row);
+ 
+         LegacyLayout.LegacyUnfilteredPartition p = LegacyLayout.fromUnfilteredRowIterator(null,
upd.unfilteredIterator());
+         assertEquals(DeletionTime.LIVE, p.partitionDeletion);
+         assertEquals(0, p.cells.size());
+ 
+         LegacyLayout.LegacyRangeTombstoneList l = p.rangeTombstones;
+         assertEquals("a", l.starts[0].collectionName.name.toString());
+         assertEquals("a", l.ends[0].collectionName.name.toString());
+ 
+         assertEquals("b", l.starts[1].collectionName.name.toString());
+         assertEquals("b", l.ends[1].collectionName.name.toString());
+     }
+ }


Mime
View raw message