Skip to content

Commit

Permalink
added multi node
Browse files Browse the repository at this point in the history
  • Loading branch information
dcapwell committed Jan 31, 2025
1 parent 3e30e7b commit 57d9a38
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.test.cql3;

import accord.utils.Property;
import accord.utils.RandomSource;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.distributed.api.ConsistencyLevel;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class AccordInteropMultiNodeTokenConflictBase extends MultiNodeTokenConflictTest
{
protected AccordInteropMultiNodeTokenConflictBase(TransactionalMode transactionalMode)
{
super(transactionalMode);
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
AccordInteropSingleNodeTableWalkBase.addUncaughtExceptionsFilter(cluster);
}

@Override
protected State createState(RandomSource rs, Cluster cluster)
{
return new AccordInteropState(rs, cluster);
}

private class AccordInteropState extends State
{
AccordInteropState(RandomSource rs, Cluster cluster)
{
super(rs, cluster);
}

@Override
protected ConsistencyLevel selectCl()
{
return ConsistencyLevel.QUORUM;
}

@Override
protected ConsistencyLevel mutationCl()
{
return ConsistencyLevel.QUORUM;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.test.cql3;

import accord.utils.Property;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class FullAccordInteropMultiNodeTokenConflictTest extends AccordInteropMultiNodeTokenConflictBase
{
protected FullAccordInteropMultiNodeTokenConflictTest()
{
super(TransactionalMode.full);
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
super.preCheck(cluster, builder);
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
// CQL_DEBUG_APPLY_OPERATOR = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.test.cql3;

import accord.utils.Property;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class MixedReadsAccordInteropMultiNodeTokenConflictTest extends AccordInteropMultiNodeTokenConflictBase
{
protected MixedReadsAccordInteropMultiNodeTokenConflictTest()
{
super(TransactionalMode.mixed_reads);
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
super.preCheck(cluster, builder);
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
// CQL_DEBUG_APPLY_OPERATOR = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,26 @@

import java.io.IOException;

import javax.annotation.Nullable;

import accord.utils.Property;
import accord.utils.RandomSource;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.distributed.api.ConsistencyLevel;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class MultiNodeTokenConflictTest extends SingleNodeTokenConflictTest
{
protected MultiNodeTokenConflictTest(@Nullable TransactionalMode transactionalMode)
{
super(transactionalMode);
}

public MultiNodeTokenConflictTest()
{
super();
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
Expand Down

0 comments on commit 57d9a38

Please sign in to comment.