adelapena commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1196804520


##########
test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeTTLOverflowUpgradeTest.java:
##########
@@ -0,0 +1,169 @@
+/*
+ * 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.distributed.upgrade;
+
+import org.junit.Test;
+
+import org.apache.cassandra.cql3.Attributes;
+import org.apache.cassandra.db.rows.Cell;
+import org.apache.cassandra.distributed.api.ICoordinator;
+import org.apache.cassandra.utils.Clock;
+import org.apache.cassandra.utils.StorageCompatibilityMode;
+import org.assertj.core.api.Assertions;
+
+import static org.apache.cassandra.distributed.api.ConsistencyLevel.ALL;
+import static org.apache.cassandra.utils.StorageCompatibilityMode.NONE;
+import static org.apache.cassandra.utils.StorageCompatibilityMode.UPGRADING;
+
+/**
+ * Tests TTL the overflow policy triggers at the correct limit: year 2038 <=nc 
or 2186 >nc
+ * <p>
+ * <=nc overflow policy triggers at year 2038. That could be <=4.1 or 5.0 with 
4.x storage compatibility
+ * >nc overflow policy triggers at year 2106. That is >=5.0 using >=5.x 
storage compatibility
+ *
+ * @see StorageCompatibilityMode
+ */
+public class MixedModeTTLOverflowUpgradeTest extends UpgradeTestBase
+{
+    @Test
+    public void testTTLOverflowDuringUpgrade() throws Throwable
+    {
+        testTTLOverflow((cluster, node) -> {
+            if (node == 1) // only node1 is upgraded, and the cluster is in 
mixed versions mode
+            {
+                assertPolicyTriggersAt2038(cluster.coordinator(1));
+                assertPolicyTriggersAt2038(cluster.coordinator(2));
+
+                // We restart the upgraded node out of 4.0 storage 
compatibility,
+                // and we set it to be compatible with 5.0.
+                // 2038 should still be the limit because there is still a not 
upgraded node.
+                cluster.get(1).shutdown().get();
+                cluster.get(1).config().set("storage_compatibility_mode", 
UPGRADING.toString());
+                cluster.get(1).startup();

Review Comment:
   Nit: We can wrap these block of three lines into a utility method, this way: 
https://github.com/adelapena/cassandra/commit/5faf80a8c137f1c7a9f2d26ab65fdcd31a2e50c8



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to