|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +package org.apache.cassandra.distributed.test.cql3; |
| 20 | + |
| 21 | +import java.io.IOException; |
| 22 | + |
| 23 | +import accord.utils.Property; |
| 24 | +import accord.utils.RandomSource; |
| 25 | +import org.apache.cassandra.distributed.Cluster; |
| 26 | +import org.apache.cassandra.distributed.api.ConsistencyLevel; |
| 27 | + |
| 28 | +public class MultiNodeTokenConflictTest extends SingleNodeTokenConflictTest |
| 29 | +{ |
| 30 | + @Override |
| 31 | + protected void preCheck(Property.StatefulBuilder builder) |
| 32 | + { |
| 33 | + // if a failing seed is detected, populate here |
| 34 | + // Example: builder.withSeed(42L); |
| 35 | + // CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value |
| 36 | + // CQL_DEBUG_APPLY_OPERATOR = true; |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + protected Cluster createCluster() throws IOException |
| 41 | + { |
| 42 | + return createCluster(3, c -> { |
| 43 | + c.set("range_request_timeout", "180s") |
| 44 | + .set("read_request_timeout", "180s") |
| 45 | + .set("write_request_timeout", "180s") |
| 46 | + .set("native_transport_timeout", "180s") |
| 47 | + .set("slow_query_log_timeout", "180s"); |
| 48 | + }); |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + protected State createState(RandomSource rs, Cluster cluster) |
| 53 | + { |
| 54 | + return new MultiNodeState(rs, cluster); |
| 55 | + } |
| 56 | + |
| 57 | + private class MultiNodeState extends State |
| 58 | + { |
| 59 | + MultiNodeState(RandomSource rs, Cluster cluster) |
| 60 | + { |
| 61 | + super(rs, cluster); |
| 62 | + } |
| 63 | + |
| 64 | + @Override |
| 65 | + protected ConsistencyLevel selectCl() |
| 66 | + { |
| 67 | + return ConsistencyLevel.ALL; |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + protected ConsistencyLevel mutationCl() |
| 72 | + { |
| 73 | + return ConsistencyLevel.NODE_LOCAL; |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments