dcapwell commented on code in PR #3108:
URL: https://github.com/apache/cassandra/pull/3108#discussion_r1491421144


##########
test/unit/org/apache/cassandra/service/accord/AccordCommandStoreFuzzTest.java:
##########
@@ -0,0 +1,457 @@
+/*
+ * 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.service.accord;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BooleanSupplier;
+import java.util.function.Function;
+import java.util.function.ToLongFunction;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import accord.impl.SizeOfIntersectionSorter;
+import accord.impl.TestAgent;
+import accord.local.Command;
+import accord.local.CommandStore;
+import accord.local.CommandStores;
+import accord.local.Node;
+import accord.local.NodeTimeService;
+import accord.local.PreLoadContext;
+import accord.local.SafeCommandStore;
+import accord.local.SaveStatus;
+import accord.messages.PreAccept;
+import accord.messages.TxnRequest;
+import accord.primitives.FullKeyRoute;
+import accord.primitives.FullRoute;
+import accord.primitives.Keys;
+import accord.primitives.Ranges;
+import accord.primitives.RoutableKey;
+import accord.primitives.Timestamp;
+import accord.primitives.Txn;
+import accord.primitives.TxnId;
+import accord.topology.Topologies;
+import accord.topology.Topology;
+import accord.utils.AccordGens;
+import accord.utils.RandomSource;
+import accord.utils.async.AsyncChain;
+import accord.utils.async.AsyncChains;
+import accord.utils.async.AsyncResult;
+import org.apache.cassandra.ServerTestUtils;
+import org.apache.cassandra.concurrent.ExecutorFactory;
+import org.apache.cassandra.concurrent.ExecutorPlus;
+import org.apache.cassandra.concurrent.ScheduledExecutorPlus;
+import org.apache.cassandra.concurrent.SimulatedExecutorFactory;
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.config.CassandraRelevantProperties;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.cql3.CQLTester;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.marshal.Int32Type;
+import org.apache.cassandra.metrics.AccordStateCacheMetrics;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.SchemaConstants;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.accord.api.PartitionKey;
+import org.apache.cassandra.tcm.ClusterMetadata;
+import org.apache.cassandra.tcm.transformations.AddAccordTable;
+import org.apache.cassandra.utils.Generators;
+import org.apache.cassandra.utils.Pair;
+import org.assertj.core.api.Assertions;
+
+import static accord.utils.Property.qt;
+import static org.apache.cassandra.service.accord.AccordTestUtils.createTxn;
+import static org.apache.cassandra.service.accord.AccordTestUtils.wrapInTxn;
+import static org.apache.cassandra.utils.AccordGenerators.fromQT;
+
+public class AccordCommandStoreFuzzTest extends CQLTester
+{
+    static
+    {
+        
CassandraRelevantProperties.TEST_ACCORD_STORE_THREAD_CHECKS_ENABLED.setBoolean(false);
+        // Restarts are not covered in these tests and the range logic is 
getting rewritten, so disable loading
+        
CassandraRelevantProperties.TEST_ACCORD_STORE_LOAD_RANGES_ENABLED.setBoolean(false);
+        // since this test does frequent truncates, the info table gets 
updated and forced flushed... which is 90% of the cost of this test...
+        // this flag disables that flush
+        CassandraRelevantProperties.UNSAFE_SYSTEM.setBoolean(true);
+    }
+
+    private static TableMetadata intTbl, reverseTokenTbl;
+    private static Node.Id nodeId;
+
+    @BeforeClass
+    public static void setUpClass()
+    {
+        CQLTester.setUpClass();
+        DatabaseDescriptor.setIncrementalBackupsEnabled(false);
+    }
+
+    @Before
+    public void init()
+    {
+        if (intTbl != null)
+            return;
+        createKeyspace("CREATE KEYSPACE test WITH replication={ 'class' : 
'SimpleStrategy', 'replication_factor' : 2 }");
+        createTable("test", "CREATE TABLE test.tbl1 (pk int PRIMARY KEY, value 
int)");
+        intTbl = Schema.instance.getTableMetadata("test", "tbl1");
+        AddAccordTable.addTable(intTbl.id);
+
+        createTable("test", "CREATE TABLE test.tbl2 (pk vector<bigint, 2> 
PRIMARY KEY, value int)");
+        reverseTokenTbl = Schema.instance.getTableMetadata("test", "tbl2");

Review Comment:
   ill remove this... this is what the range tests use.  The range tests work 
with random tokens so can't use `int` as the primary key...



-- 
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