You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "smiklosovic (via GitHub)" <gi...@apache.org> on 2023/11/07 14:09:38 UTC
[PR] CASSANDRA-19002 trunk hints and commit upgrade tests [cassandra]
smiklosovic opened a new pull request, #2872:
URL: https://github.com/apache/cassandra/pull/2872
Thanks for sending a pull request! Here are some tips if you're new here:
* Ensure you have added or run the [appropriate tests](https://cassandra.apache.org/_/development/testing.html) for your PR.
* Be sure to keep the PR description updated to reflect all changes.
* Write your PR title to summarize what this PR proposes.
* If possible, provide a concise example to reproduce the issue for a faster review.
* Read our [contributor guidelines](https://cassandra.apache.org/_/development/index.html)
* If you're making a documentation change, see our [guide to documentation contribution](https://cassandra.apache.org/_/development/documentation.html)
Commit messages should follow the following format:
```
<One sentence description, usually Jira title or CHANGES.txt summary>
<Optional lengthier description (context on patch)>
patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>
```
The [Cassandra Jira](https://issues.apache.org/jira/projects/CASSANDRA/issues/)
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19002 trunk hints and commit upgrade tests [cassandra]
Posted by "michaelsembwever (via GitHub)" <gi...@apache.org>.
michaelsembwever commented on code in PR #2872:
URL: https://github.com/apache/cassandra/pull/2872#discussion_r1386303526
##########
test/unit/org/apache/cassandra/hints/HintsUpgradeTest.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * 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.hints;
+
+import java.nio.ByteBuffer;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.function.Consumer;
+
+import com.google.common.collect.ImmutableMap;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.Mutation;
+import org.apache.cassandra.db.marshal.AsciiType;
+import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.partitions.PartitionUpdate;
+import org.apache.cassandra.db.rows.Cell;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.io.util.File;
+import org.apache.cassandra.io.util.FileInputStreamPlus;
+import org.apache.cassandra.schema.KeyspaceParams;
+import org.apache.cassandra.schema.SchemaTestUtil;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.schema.TableMetadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class HintsUpgradeTest
+{
+ static
+ {
+ DatabaseDescriptor.daemonInitialization();
+ }
+
+ private static final String KEYSPACE = "Keyspace1";
+ private static final String TABLE = "Standard1";
+ private static final String CELLNAME = "name";
+
+ private static final String DATA_DIR = "test/data/legacy-hints/";
+ private static final String PROPERTIES_FILE = "hash.txt";
+ private static final String HOST_ID_PROPERTY = "hostId";
+ private static final String CFID_PROPERTY = "cfid";
+ private static final String CELLS_PROPERTY = "cells";
+ private static final String DESCRIPTOR_TIMESTAMP_PROPERTY = "descriptorTimestamp";
+ private static final String HASH_PROPERTY = "hash";
+
+ static TableMetadata.Builder metadataBuilder = TableMetadata.builder(KEYSPACE, TABLE)
+ .addPartitionKeyColumn("key", AsciiType.instance)
+ .addClusteringColumn("col", AsciiType.instance)
+ .addRegularColumn("val", BytesType.instance)
+ .addRegularColumn("val0", BytesType.instance)
+ .compression(SchemaLoader.getCompressionParameters());
+
+ @BeforeClass
+ public static void initialize()
+ {
+ SchemaLoader.loadSchema();
+ SchemaLoader.createKeyspace(KEYSPACE, KeyspaceParams.simple(1));
+ }
+
+ @After
+ public void teardown()
+ {
+ SchemaTestUtil.announceTableDrop(KEYSPACE, TABLE);
+ }
+
+ private static class HintProperties
+ {
+ private UUID hostId;
+ private String tableId;
+ private int cells;
+ private long descriptorTimestamp;
+ private int hash;
+ private File dir;
+ }
+
+ private HintProperties init(String version) throws Exception
+ {
+ HintProperties properties = loadHintProperties(DATA_DIR + version);
+ SchemaTestUtil.announceNewTable(metadataBuilder.id(TableId.fromString(properties.tableId)).build());
+ return properties;
+ }
+
+ @Test // version 1 of hints
+ public void test30() throws Exception
+ {
+ HintProperties properties = init("3.0.29");
+ readHints(properties);
+ }
+
+ @Test // version 2 of hints
+ public void test41() throws Exception
+ {
+ HintProperties properties = init("4.1.3");
+ readHints(properties);
+ }
Review Comment:
nit: how can we fail when new hints versions are added but there's no corresponding test…?
##########
test/unit/org/apache/cassandra/hints/HintsUpgradeTest.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * 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.hints;
+
+import java.nio.ByteBuffer;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.function.Consumer;
+
+import com.google.common.collect.ImmutableMap;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.Mutation;
+import org.apache.cassandra.db.marshal.AsciiType;
+import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.partitions.PartitionUpdate;
+import org.apache.cassandra.db.rows.Cell;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.io.util.File;
+import org.apache.cassandra.io.util.FileInputStreamPlus;
+import org.apache.cassandra.schema.KeyspaceParams;
+import org.apache.cassandra.schema.SchemaTestUtil;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.schema.TableMetadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class HintsUpgradeTest
+{
+ static
+ {
+ DatabaseDescriptor.daemonInitialization();
+ }
+
+ private static final String KEYSPACE = "Keyspace1";
+ private static final String TABLE = "Standard1";
+ private static final String CELLNAME = "name";
+
+ private static final String DATA_DIR = "test/data/legacy-hints/";
+ private static final String PROPERTIES_FILE = "hash.txt";
+ private static final String HOST_ID_PROPERTY = "hostId";
+ private static final String CFID_PROPERTY = "cfid";
+ private static final String CELLS_PROPERTY = "cells";
+ private static final String DESCRIPTOR_TIMESTAMP_PROPERTY = "descriptorTimestamp";
+ private static final String HASH_PROPERTY = "hash";
+
+ static TableMetadata.Builder metadataBuilder = TableMetadata.builder(KEYSPACE, TABLE)
+ .addPartitionKeyColumn("key", AsciiType.instance)
+ .addClusteringColumn("col", AsciiType.instance)
+ .addRegularColumn("val", BytesType.instance)
+ .addRegularColumn("val0", BytesType.instance)
+ .compression(SchemaLoader.getCompressionParameters());
+
+ @BeforeClass
+ public static void initialize()
+ {
+ SchemaLoader.loadSchema();
+ SchemaLoader.createKeyspace(KEYSPACE, KeyspaceParams.simple(1));
+ }
+
+ @After
+ public void teardown()
+ {
+ SchemaTestUtil.announceTableDrop(KEYSPACE, TABLE);
+ }
+
+ private static class HintProperties
+ {
+ private UUID hostId;
+ private String tableId;
+ private int cells;
+ private long descriptorTimestamp;
+ private int hash;
+ private File dir;
+ }
+
+ private HintProperties init(String version) throws Exception
+ {
+ HintProperties properties = loadHintProperties(DATA_DIR + version);
+ SchemaTestUtil.announceNewTable(metadataBuilder.id(TableId.fromString(properties.tableId)).build());
+ return properties;
+ }
+
+ @Test // version 1 of hints
+ public void test30() throws Exception
+ {
+ HintProperties properties = init("3.0.29");
+ readHints(properties);
+ }
+
+ @Test // version 2 of hints
+ public void test41() throws Exception
+ {
+ HintProperties properties = init("4.1.3");
+ readHints(properties);
+ }
Review Comment:
nit: how can we fail when new hints versions are added but there's no corresponding test…?
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19002 trunk hints and commit upgrade tests [cassandra]
Posted by "michaelsembwever (via GitHub)" <gi...@apache.org>.
michaelsembwever commented on code in PR #2872:
URL: https://github.com/apache/cassandra/pull/2872#discussion_r1386302522
##########
test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java:
##########
@@ -102,6 +103,27 @@ public void cleanUp()
Assert.assertEquals("JVM killed", shouldBeKilled, killerForTests.wasKilled());
}
+ // 30 matches version in MessagingService, 3.0.13 is the latest patch release after 3.0.0 but before 3.0.14
+ @Test
+ public void test30_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "3.0.13-encrypted");
+ }
+
+ // 3014 matches version in MessagingService, 3.0.29 is the latest patch release after 3.0.14
+ @Test
+ public void test3014_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "3.0.29-encrypted");
+ }
+
+ // 40 matches version in MessagingService, 4.0.11 is the latest patch release on 4.0
+ @Test
+ public void test40_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "4.0.11-encrypted");
+ }
+
Review Comment:
nit: how can we fail when new MS versions are added but there's no corresponding test…?
##########
test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java:
##########
@@ -102,6 +103,27 @@ public void cleanUp()
Assert.assertEquals("JVM killed", shouldBeKilled, killerForTests.wasKilled());
}
+ // 30 matches version in MessagingService, 3.0.13 is the latest patch release after 3.0.0 but before 3.0.14
+ @Test
+ public void test30_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "3.0.13-encrypted");
+ }
+
+ // 3014 matches version in MessagingService, 3.0.29 is the latest patch release after 3.0.14
+ @Test
+ public void test3014_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "3.0.29-encrypted");
+ }
+
+ // 40 matches version in MessagingService, 4.0.11 is the latest patch release on 4.0
+ @Test
+ public void test40_encrypted() throws Exception
+ {
+ testRestore(DATA_DIR + "4.0.11-encrypted");
+ }
+
Review Comment:
nit: how can we fail when new MS versions are added but there's no corresponding test…?
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19002 trunk hints and commit upgrade tests [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic closed pull request #2872: CASSANDRA-19002 trunk hints and commit upgrade tests
URL: https://github.com/apache/cassandra/pull/2872
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org