cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject [5/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Date Fri, 29 Sep 2017 12:27:28 GMT
Merge branch 'cassandra-3.0' into cassandra-3.11


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

Branch: refs/heads/cassandra-3.11
Commit: 2a24acfa9926408216f5fde325abe0a8fd6b608a
Parents: 0bc45aa ab0adf9
Author: Jason Brown <jasedbrown@gmail.com>
Authored: Fri Sep 29 05:21:32 2017 -0700
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Fri Sep 29 05:24:11 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 src/java/org/apache/cassandra/cql3/Lists.java   |  76 +++++++--
 .../org/apache/cassandra/cql3/ListsTest.java    | 166 +++++++++++++++++++
 3 files changed, 226 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2a24acfa/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 80a8295,a1f49cd..6c3a1d0
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,19 -1,8 +1,20 @@@
 -3.0.15
 +3.11.1
 +=======
 + * Fix the computation of cdc_total_space_in_mb for exabyte filesystems (CASSANDRA-13808)
 + * Handle limit correctly on tables with strict liveness (CASSANDRA-13883)
 + * AbstractTokenTreeBuilder#serializedSize returns wrong value when there is a single leaf
and overflow collisions (CASSANDRA-13869)
 + * Add a compaction option to TWCS to ignore sstables overlapping checks (CASSANDRA-13418)
 + * BTree.Builder memory leak (CASSANDRA-13754)
 + * Revert CASSANDRA-10368 of supporting non-pk column filtering due to correctness (CASSANDRA-13798)
 + * Fix cassandra-stress hang issues when an error during cluster connection happens (CASSANDRA-12938)
 + * Better bootstrap failure message when blocked by (potential) range movement (CASSANDRA-13744)
 + * "ignore" option is ignored in sstableloader (CASSANDRA-13721)
 + * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
 + * Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
 + * Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
 +Merged from 3.0:
+  * AssertionError prepending to a list (CASSANDRA-13149)
   * Fix support for SuperColumn tables (CASSANDRA-12373)
 - * Handle limit correctly on tables with strict liveness (CASSANDRA-13883)
 - * Fix missing original update in TriggerExecutor (CASSANDRA-13894)
   * Remove non-rpc-ready nodes from counter leader candidates (CASSANDRA-13043)
   * Improve short read protection performance (CASSANDRA-13794)
   * Fix sstable reader to support range-tombstone-marker for multi-slices (CASSANDRA-13787)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2a24acfa/src/java/org/apache/cassandra/cql3/Lists.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2a24acfa/test/unit/org/apache/cassandra/cql3/ListsTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/ListsTest.java
index 0000000,9ca0010..07623a2
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/cql3/ListsTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ListsTest.java
@@@ -1,0 -1,166 +1,166 @@@
+ /*
+  * 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.cql3;
+ 
+ import java.nio.ByteBuffer;
+ import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.List;
+ import java.util.UUID;
+ 
+ import com.google.common.collect.Iterators;
+ import org.junit.Assert;
+ import org.junit.Test;
+ 
+ import org.apache.cassandra.config.CFMetaData;
+ import org.apache.cassandra.config.ColumnDefinition;
+ import org.apache.cassandra.cql3.Lists.PrecisionTime;
+ import org.apache.cassandra.db.Clustering;
+ import org.apache.cassandra.db.DecoratedKey;
+ import org.apache.cassandra.db.rows.Cell;
+ import org.apache.cassandra.db.rows.Row;
+ import org.apache.cassandra.dht.Murmur3Partitioner;
+ import org.apache.cassandra.utils.ByteBufferUtil;
+ import org.apache.cassandra.utils.UUIDGen;
+ 
+ public class ListsTest extends CQLTester
+ {
+     private static final long DEFAULT_MILLIS = 424242424242L;
+     private static final int DEFAULT_NANOS = PrecisionTime.MAX_NANOS;
+ 
+     @Test
+     public void testPrecisionTime_getNext_simple()
+     {
+         PrecisionTime.set(DEFAULT_MILLIS, DEFAULT_NANOS);
+ 
+         long millis = DEFAULT_MILLIS - 100;
+         int count = 1;
+         PrecisionTime next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(millis, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - count, next.nanos);
+ 
+         next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(millis, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - (count * 2), next.nanos);
+     }
+ 
+     @Test
+     public void testPrecisionTime_getNext_Mulitple()
+     {
+         PrecisionTime.set(DEFAULT_MILLIS, DEFAULT_NANOS);
+ 
+         long millis = DEFAULT_MILLIS - 100;
+         int count = DEFAULT_NANOS / 2;
+         PrecisionTime next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(millis, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - count, next.nanos);
+     }
+ 
+     @Test
+     public void testPrecisionTime_getNext_RollOverNanos()
+     {
+         final int remainingNanos = 0;
+         PrecisionTime.set(DEFAULT_MILLIS, remainingNanos);
+ 
+         long millis = DEFAULT_MILLIS;
+         int count = 1;
+         PrecisionTime next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(millis - 1, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - count, next.nanos);
+ 
+         next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(millis - 1, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - (count * 2), next.nanos);
+     }
+ 
+     @Test
+     public void testPrecisionTime_getNext_BorkedClock()
+     {
+         final int remainingNanos = 1;
+         PrecisionTime.set(DEFAULT_MILLIS, remainingNanos);
+ 
+         long millis = DEFAULT_MILLIS + 100;
+         int count = 1;
+         PrecisionTime next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(DEFAULT_MILLIS, next.millis);
+         Assert.assertEquals(remainingNanos - count, next.nanos);
+ 
+         // this should roll the clock
+         next = PrecisionTime.getNext(millis, count);
+         Assert.assertEquals(DEFAULT_MILLIS - 1, next.millis);
+         Assert.assertEquals(DEFAULT_NANOS - count, next.nanos);
+     }
+ 
+     @Test
+     public void testPrepender_SmallList()
+     {
+         List<ByteBuffer> terms = new ArrayList<>();
+         terms.add(ByteBufferUtil.bytes(1));
+         terms.add(ByteBufferUtil.bytes(2));
+         terms.add(ByteBufferUtil.bytes(3));
+         terms.add(ByteBufferUtil.bytes(4));
+         terms.add(ByteBufferUtil.bytes(5));
+         testPrepender_execute(terms);
+     }
+ 
+     @Test
+     public void testPrepender_HugeList()
+     {
+         List<ByteBuffer> terms = new ArrayList<>();
+         // create a large enough array, then remove some off the end, just to make it an
odd size
+         for (int i = 0; i < PrecisionTime.MAX_NANOS * 4 - 287; i++)
+             terms.add(ByteBufferUtil.bytes(i));
+         testPrepender_execute(terms);
+     }
+ 
+     private void testPrepender_execute(List<ByteBuffer> terms)
+     {
+         createTable("CREATE TABLE %s (k int PRIMARY KEY, l list<text>)");
+         CFMetaData metaData = currentTableMetadata();
+ 
+         ColumnDefinition columnDefinition = metaData.getColumnDefinition(ByteBufferUtil.bytes("l"));
+         Term term = new Lists.Value(terms);
+         Lists.Prepender prepender = new Lists.Prepender(columnDefinition, term);
+ 
+         ByteBuffer keyBuf = ByteBufferUtil.bytes("key");
+         DecoratedKey key = Murmur3Partitioner.instance.decorateKey(keyBuf);
+         UpdateParameters parameters = new UpdateParameters(metaData, null, null, System.currentTimeMillis(),
1000, Collections.emptyMap());
 -        Clustering clustering = new Clustering(ByteBufferUtil.bytes(1));
++        Clustering clustering = Clustering.make(ByteBufferUtil.bytes(1));
+         parameters.newRow(clustering);
+         prepender.execute(key, parameters);
+ 
+         Row row = parameters.buildRow();
+         Assert.assertEquals(terms.size(), Iterators.size(row.cells().iterator()));
+ 
+         int idx = 0;
+         UUID last = null;
+         for (Cell cell : row.cells())
+         {
+             UUID uuid = UUIDGen.getUUID(cell.path().get(0));
+ 
+             if (last != null)
+                 Assert.assertTrue(last.compareTo(uuid) < 0);
+             last = uuid;
+ 
+             Assert.assertEquals(String.format("different values found: expected: '%d', found
'%d'", ByteBufferUtil.toInt(terms.get(idx)), ByteBufferUtil.toInt(cell.value())),
+                                 terms.get(idx), cell.value());
+             idx++;
+         }
+     }
+ }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message