cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [5/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Date Wed, 06 Dec 2017 21:25: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/f77b663d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f77b663d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f77b663d

Branch: refs/heads/cassandra-3.11
Commit: f77b663d1ba370ed66d56e1558aa12460c6c6414
Parents: ae78231 461af5b
Author: Paulo Motta <paulo@apache.org>
Authored: Thu Dec 7 08:17:24 2017 +1100
Committer: Paulo Motta <paulo@apache.org>
Committed: Thu Dec 7 08:17:49 2017 +1100

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 .../org/apache/cassandra/cql3/Attributes.java   |   6 +
 .../org/apache/cassandra/db/LivenessInfo.java   |  62 ++++-
 .../cassandra/db/view/ViewUpdateGenerator.java  |  10 +-
 .../apache/cassandra/schema/TableParams.java    |   4 +
 .../apache/cassandra/tools/JsonTransformer.java |   2 +-
 .../org/apache/cassandra/cql3/ViewLongTest.java | 231 +++++++++++++++++++
 .../cql3/validation/operations/TTLTest.java     | 104 +++++++++
 .../apache/cassandra/db/LivenessInfoTest.java   | 112 +++++++++
 9 files changed, 524 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 60215c4,54a8538..8a7158d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,13 -1,5 +1,14 @@@
 +3.11.2
 + * Remove OpenJDK log warning (CASSANDRA-13916)
 + * Prevent compaction strategies from looping indefinitely (CASSANDRA-14079)
 + * Cache disk boundaries (CASSANDRA-13215)
 + * Add asm jar to build.xml for maven builds (CASSANDRA-11193)
 + * Round buffer size to powers of 2 for the chunk cache (CASSANDRA-13897)
 + * Update jackson JSON jars (CASSANDRA-13949)
 + * Avoid locks when checking LCS fanout and if we should defrag (CASSANDRA-13930)
 +Merged from 3.0:
  3.0.16
 - * Fix updating base table rows with TTL not removing materialized view entries (CASSANDRA-14071)
++ * Fix updating base table rows with TTL not removing view entries (CASSANDRA-14071)
   * Reduce garbage created by DynamicSnitch (CASSANDRA-14091)
   * More frequent commitlog chained markers (CASSANDRA-13987)
   * Fix serialized size of DataLimits (CASSANDRA-14057)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/src/java/org/apache/cassandra/cql3/Attributes.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/src/java/org/apache/cassandra/db/LivenessInfo.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/LivenessInfo.java
index b581f78,89e0578..5d17aea
--- a/src/java/org/apache/cassandra/db/LivenessInfo.java
+++ b/src/java/org/apache/cassandra/db/LivenessInfo.java
@@@ -68,10 -81,12 +76,12 @@@ public class LivenessInf
               : expiring(timestamp, ttl, nowInSec);
      }
  
 -    // Note that this ctor ignores the default table ttl and takes the expiration time,
not the current time.
 +    // Note that this ctor takes the expiration time, not the current time.
      // Use when you know that's what you want.
 -    public static LivenessInfo create(long timestamp, int ttl, int localExpirationTime)
 +    public static LivenessInfo withExpirationTime(long timestamp, int ttl, int localExpirationTime)
      {
+         if (ttl == EXPIRED_LIVENESS_TTL)
+             return new ExpiredLivenessInfo(timestamp, ttl, localExpirationTime);
          return ttl == NO_TTL ? new LivenessInfo(timestamp) : new ExpiringLivenessInfo(timestamp,
ttl, localExpirationTime);
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/src/java/org/apache/cassandra/db/view/ViewUpdateGenerator.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/view/ViewUpdateGenerator.java
index a4a1252,74d3e52..7937e05
--- a/src/java/org/apache/cassandra/db/view/ViewUpdateGenerator.java
+++ b/src/java/org/apache/cassandra/db/view/ViewUpdateGenerator.java
@@@ -403,11 -403,13 +403,13 @@@ public class ViewUpdateGenerato
          if (timestamp > rowDeletion)
          {
              /**
-               * TODO: This is a hack and overload of LivenessInfo and we should probably
modify
-               * the storage engine to properly support this, but on the meantime this
-               * should be fine because it only happens in some specific scenarios explained
above.
+               * We use an expired liveness instead of a row tombstone to allow a shadowed
MV
+               * entry to co-exist with a row tombstone, see ViewComplexTest#testCommutativeRowDeletion.
+               *
+               * TODO This is a dirty overload of LivenessInfo and we should modify
+               * the storage engine to properly support this on CASSANDRA-13826.
                */
-             LivenessInfo info = LivenessInfo.withExpirationTime(timestamp, Integer.MAX_VALUE,
nowInSec);
 -            LivenessInfo info = LivenessInfo.create(timestamp, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSec);
++            LivenessInfo info = LivenessInfo.withExpirationTime(timestamp, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSec);
              currentViewEntryBuilder.addPrimaryKeyLivenessInfo(info);
          }
          currentViewEntryBuilder.addRowDeletion(mergedBaseRow.deletion());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/src/java/org/apache/cassandra/schema/TableParams.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/TableParams.java
index 02112af,dfa8603..3750aa1
--- a/src/java/org/apache/cassandra/schema/TableParams.java
+++ b/src/java/org/apache/cassandra/schema/TableParams.java
@@@ -24,9 -24,9 +24,10 @@@ import com.google.common.base.MoreObjec
  import com.google.common.base.Objects;
  import com.google.common.collect.ImmutableMap;
  
+ import org.apache.cassandra.cql3.Attributes;
  import org.apache.cassandra.exceptions.ConfigurationException;
  import org.apache.cassandra.utils.BloomCalculations;
 +
  import static java.lang.String.format;
  
  public final class TableParams

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/src/java/org/apache/cassandra/tools/JsonTransformer.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/JsonTransformer.java
index c3a0a17,c679fc3..23ea3a6
--- a/src/java/org/apache/cassandra/tools/JsonTransformer.java
+++ b/src/java/org/apache/cassandra/tools/JsonTransformer.java
@@@ -344,7 -347,7 +344,7 @@@ public final class JsonTransforme
                  }
                  else
                  {
-                     json.writeString(column.cellValueType().getString(clustering.get(i)));
 -                    json.writeRawValue(column.cellValueType().toJSONString(clustering.get(i),
Server.CURRENT_VERSION));
++                    json.writeRawValue(column.cellValueType().toJSONString(clustering.get(i),
ProtocolVersion.CURRENT));
                  }
              }
              json.writeEndArray();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/test/long/org/apache/cassandra/cql3/ViewLongTest.java
----------------------------------------------------------------------
diff --cc test/long/org/apache/cassandra/cql3/ViewLongTest.java
index 590f148,68931e2..ddf62e9
--- a/test/long/org/apache/cassandra/cql3/ViewLongTest.java
+++ b/test/long/org/apache/cassandra/cql3/ViewLongTest.java
@@@ -32,9 -33,12 +33,14 @@@ import org.junit.Test
  import com.datastax.driver.core.Row;
  import com.datastax.driver.core.exceptions.NoHostAvailableException;
  import com.datastax.driver.core.exceptions.WriteTimeoutException;
 +import org.apache.cassandra.batchlog.BatchlogManager;
 +import org.apache.cassandra.concurrent.NamedThreadFactory;
 +import org.apache.cassandra.transport.ProtocolVersion;
+ import org.apache.cassandra.concurrent.SEPExecutor;
+ import org.apache.cassandra.concurrent.Stage;
+ import org.apache.cassandra.concurrent.StageManager;
+ import org.apache.cassandra.db.Keyspace;
 -import org.apache.cassandra.batchlog.BatchlogManager;
+ import org.apache.cassandra.utils.FBUtilities;
  import org.apache.cassandra.utils.WrappedRunnable;
  
  public class ViewLongTest extends CQLTester

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f77b663d/test/unit/org/apache/cassandra/db/LivenessInfoTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/LivenessInfoTest.java
index 0000000,b08023c..83d670c
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/db/LivenessInfoTest.java
+++ b/test/unit/org/apache/cassandra/db/LivenessInfoTest.java
@@@ -1,0 -1,112 +1,112 @@@
+ /**
+  * 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 static org.junit.Assert.*;
+ 
+ import org.apache.cassandra.utils.FBUtilities;
 -
++import org.apache.hadoop.mapred.machines_jsp;
+ import org.junit.Test;
+ 
+ public class LivenessInfoTest
+ {
+     @Test
+     public void testSupersedes()
+     {
+         LivenessInfo first;
+         LivenessInfo second;
+         int nowInSeconds = FBUtilities.nowInSeconds();
+ 
+         // timestamp supersedes for normal liveness info
+         first = LivenessInfo.create(100, 0, nowInSeconds);
+         second = LivenessInfo.create(101, 0, nowInSeconds);
+         assertSupersedes(second, first);
+ 
+         // timestamp supersedes for ttl
+         first = LivenessInfo.create(100, 0, nowInSeconds);
+         second = LivenessInfo.expiring(99, 1, nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         // timestamp supersedes for mv expired liveness
+         first = LivenessInfo.create(100, 0, nowInSeconds);
 -        second = LivenessInfo.create(99, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds);
++        second = LivenessInfo.withExpirationTime(99, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         // timestamp ties, ttl supersedes non-ttl
+         first = LivenessInfo.expiring(100, 1, nowInSeconds);
+         second = LivenessInfo.create(100, 0, nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         // timestamp ties, greater localDeletionTime supersedes
+         first = LivenessInfo.expiring(100, 2, nowInSeconds);
+         second = LivenessInfo.expiring(100, 1, nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         first = LivenessInfo.expiring(100, 5, nowInSeconds - 4);
+         second = LivenessInfo.expiring(100, 2, nowInSeconds);
+         assertSupersedes(second, first);
+ 
+         // timestamp ties, mv expired liveness supersedes normal ttl
 -        first = LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds);
++        first = LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds);
+         second = LivenessInfo.expiring(100, 1000, nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         // timestamp ties, mv expired liveness supersedes non-ttl
 -        first = LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds);
++        first = LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds);
+         second = LivenessInfo.create(100, 0, nowInSeconds);
+         assertSupersedes(first, second);
+ 
+         // timestamp ties, both are mv expired liveness, local deletion time win
 -        first = LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds
+ 1);
 -        second = LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds);
++        first = LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds + 1);
++        second = LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds);
+         assertSupersedes(first, second);
+     }
+ 
+     @Test
+     public void testIsLive()
+     {
+         int nowInSeconds = FBUtilities.nowInSeconds();
+ 
+         assertIsLive(LivenessInfo.create(100, 0, nowInSeconds), nowInSeconds - 3, true);
+         assertIsLive(LivenessInfo.create(100, 0, nowInSeconds), nowInSeconds, true);
+         assertIsLive(LivenessInfo.create(100, 0, nowInSeconds), nowInSeconds + 3, true);
+ 
+         assertIsLive(LivenessInfo.expiring(100, 2, nowInSeconds), nowInSeconds - 3, true);
+         assertIsLive(LivenessInfo.expiring(100, 2, nowInSeconds), nowInSeconds, true);
+         assertIsLive(LivenessInfo.expiring(100, 2, nowInSeconds), nowInSeconds + 3, false);
+ 
 -        assertIsLive(LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds),
nowInSeconds - 3, false);
 -        assertIsLive(LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds),
nowInSeconds, false);
 -        assertIsLive(LivenessInfo.create(100, LivenessInfo.EXPIRED_LIVENESS_TTL, nowInSeconds),
nowInSeconds + 3, false);
++        assertIsLive(LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds), nowInSeconds - 3, false);
++        assertIsLive(LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds), nowInSeconds, false);
++        assertIsLive(LivenessInfo.withExpirationTime(100, LivenessInfo.EXPIRED_LIVENESS_TTL,
nowInSeconds), nowInSeconds + 3, false);
+     }
+ 
+     /**
+      * left supersedes right, right doesn't supersede left.
+      */
+     private static void assertSupersedes(LivenessInfo left, LivenessInfo right)
+     {
+         assertTrue(left.supersedes(right));
+         assertFalse(right.supersedes(left));
+     }
+ 
+     private static void assertIsLive(LivenessInfo info, int nowInSec, boolean alive)
+     {
+         assertEquals(info.isLive(nowInSec), alive);
+     }
+ }


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


Mime
View raw message