- make sure workspace.xml specifies a storagedir

- removing unnecessary calls to ServerTestUtils.daemonInitialization() in a handful of tests
- minor cleanup in Verb and BTreeSet
This commit is contained in:
Caleb Rackliffe 2023-05-26 11:25:52 -05:00 committed by David Capwell
parent 537c1f991a
commit f54144d1c1
7 changed files with 30 additions and 39 deletions

View File

@ -189,6 +189,7 @@
-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true -Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true
-Dcassandra.ring_delay_ms=10000 -Dcassandra.ring_delay_ms=10000
-Dcassandra.skip_sync=true -Dcassandra.skip_sync=true
-Dcassandra.storagedir=$PROJECT_DIR$/data
-Dcassandra.strict.runtime.checks=true -Dcassandra.strict.runtime.checks=true
-Dcassandra.test.flush_local_schema_changes=false -Dcassandra.test.flush_local_schema_changes=false
-Dcassandra.test.messagingService.nonGracefulShutdown=true -Dcassandra.test.messagingService.nonGracefulShutdown=true

View File

@ -150,6 +150,7 @@ public class ClusteringIndexNamesFilter extends AbstractClusteringIndexFilter
return false; return false;
} }
@Override
public String toString(TableMetadata metadata) public String toString(TableMetadata metadata)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -197,6 +198,22 @@ public class ClusteringIndexNamesFilter extends AbstractClusteringIndexFilter
return sb.toString(); return sb.toString();
} }
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClusteringIndexNamesFilter that = (ClusteringIndexNamesFilter) o;
return Objects.equals(clusterings, that.clusterings) &&
Objects.equals(reversed, that.reversed);
}
@Override
public int hashCode()
{
return Objects.hash(clusterings, reversed);
}
public Kind kind() public Kind kind()
{ {
return Kind.NAMES; return Kind.NAMES;

View File

@ -21,7 +21,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.function.ToLongFunction; import java.util.function.ToLongFunction;
@ -364,30 +363,20 @@ public enum Verb
*/ */
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler) Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler)
{ {
this(NORMAL, id, priority, expiration, stage, serializer, handler, null, null); this(NORMAL, id, priority, expiration, stage, serializer, handler, null);
}
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Predicate<?> isFinalReply)
{
this(NORMAL, id, priority, expiration, stage, serializer, handler, null, isFinalReply);
} }
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb) Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb)
{ {
this(NORMAL, id, priority, expiration, stage, serializer, handler, responseVerb, null); this(NORMAL, id, priority, expiration, stage, serializer, handler, responseVerb);
} }
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler) Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler)
{ {
this(kind, id, priority, expiration, stage, serializer, handler, null, null); this(kind, id, priority, expiration, stage, serializer, handler, null);
} }
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Predicate<?> isFinalReply) Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb)
{
this(kind, id, priority, expiration, stage, serializer, handler, null, isFinalReply);
}
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb, Predicate<?> isFinalReply)
{ {
this.stage = stage; this.stage = stage;
if (id < 0) if (id < 0)

View File

@ -27,13 +27,11 @@ import java.util.ListIterator;
import java.util.NavigableSet; import java.util.NavigableSet;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.Spliterator; import java.util.Spliterator;
import java.util.Spliterators; import java.util.Spliterators;
import java.util.function.Function; import java.util.function.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering; import com.google.common.collect.Ordering;
import org.apache.cassandra.utils.btree.BTree.Dir; import org.apache.cassandra.utils.btree.BTree.Dir;
@ -242,13 +240,6 @@ public class BTreeSet<V> extends AbstractSet<V> implements NavigableSet<V>, List
} }
@Override @Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || !(o instanceof Set)) return false;
return Iterables.elementsEqual(this, (Set) o);
}
public int hashCode() public int hashCode()
{ {
// we can't just delegate to Arrays.deepHashCode(), // we can't just delegate to Arrays.deepHashCode(),

View File

@ -47,11 +47,10 @@ import static org.apache.cassandra.db.ConsistencyLevel.NODE_LOCAL;
public class TxnAuthTest extends CQLTester public class TxnAuthTest extends CQLTester
{ {
@BeforeClass @BeforeClass
public static void setUpAuthAndAccord() throws Exception public static void setUpAuthAndAccord()
{ {
CassandraRelevantProperties.ENABLE_NODELOCAL_QUERIES.setBoolean(true); CassandraRelevantProperties.ENABLE_NODELOCAL_QUERIES.setBoolean(true);
SchemaLoader.prepareServer();
IRoleManager roleManager = new AuthTestUtils.LocalCassandraRoleManager(); IRoleManager roleManager = new AuthTestUtils.LocalCassandraRoleManager();
SchemaLoader.setupAuth(roleManager, SchemaLoader.setupAuth(roleManager,
new AuthTestUtils.LocalPasswordAuthenticator(), new AuthTestUtils.LocalPasswordAuthenticator(),

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.config.DatabaseDescriptor;
public class CDCStatementTest extends CQLTester public class CDCStatementTest extends CQLTester
@ -30,19 +29,18 @@ public class CDCStatementTest extends CQLTester
@BeforeClass @BeforeClass
public static void enableCDC() public static void enableCDC()
{ {
ServerTestUtils.daemonInitialization();
DatabaseDescriptor.setCDCEnabled(true); DatabaseDescriptor.setCDCEnabled(true);
} }
@Test @Test
public void testEnableOnCreate() throws Throwable public void testEnableOnCreate()
{ {
createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;"); createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;");
Assert.assertTrue(currentTableMetadata().params.cdc); Assert.assertTrue(currentTableMetadata().params.cdc);
} }
@Test @Test
public void testEnableOnAlter() throws Throwable public void testEnableOnAlter()
{ {
createTable("CREATE TABLE %s (key text, val int, primary key(key));"); createTable("CREATE TABLE %s (key text, val int, primary key(key));");
Assert.assertFalse(currentTableMetadata().params.cdc); Assert.assertFalse(currentTableMetadata().params.cdc);
@ -51,7 +49,7 @@ public class CDCStatementTest extends CQLTester
} }
@Test @Test
public void testDisableOnAlter() throws Throwable public void testDisableOnAlter()
{ {
createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;"); createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;");
Assert.assertTrue(currentTableMetadata().params.cdc); Assert.assertTrue(currentTableMetadata().params.cdc);

View File

@ -39,7 +39,6 @@ import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import com.datastax.driver.core.exceptions.InvalidQueryException; import com.datastax.driver.core.exceptions.InvalidQueryException;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.cql3.CQLTester; import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.db.Mutation; import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.marshal.Int32Type; import org.apache.cassandra.db.marshal.Int32Type;
@ -57,7 +56,6 @@ import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.service.StorageServiceMBean; import org.apache.cassandra.service.StorageServiceMBean;
import org.apache.cassandra.triggers.ITrigger; import org.apache.cassandra.triggers.ITrigger;
import static java.lang.String.format; import static java.lang.String.format;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -209,8 +207,6 @@ public class VirtualTableTest extends CQLTester
@BeforeClass @BeforeClass
public static void setUpVirtualTables() public static void setUpVirtualTables()
{ {
ServerTestUtils.daemonInitialization();
TableMetadata vt1Metadata = TableMetadata.builder(KS_NAME, VT1_NAME) TableMetadata vt1Metadata = TableMetadata.builder(KS_NAME, VT1_NAME)
.kind(TableMetadata.Kind.VIRTUAL) .kind(TableMetadata.Kind.VIRTUAL)
.addPartitionKeyColumn("pk", UTF8Type.instance) .addPartitionKeyColumn("pk", UTF8Type.instance)
@ -1051,7 +1047,7 @@ public class VirtualTableTest extends CQLTester
} }
@Test @Test
public void testDisallowedFilteringOnRegularColumn() throws Throwable public void testDisallowedFilteringOnRegularColumn()
{ {
try try
{ {
@ -1065,7 +1061,7 @@ public class VirtualTableTest extends CQLTester
} }
@Test @Test
public void testDisallowedFilteringOnClusteringColumn() throws Throwable public void testDisallowedFilteringOnClusteringColumn()
{ {
try try
{ {
@ -1079,13 +1075,13 @@ public class VirtualTableTest extends CQLTester
} }
@Test @Test
public void testAllowedFilteringOnRegularColumn() throws Throwable public void testAllowedFilteringOnRegularColumn()
{ {
executeNet(format("SELECT * FROM %s.%s WHERE v2 = 5", KS_NAME, VT1_NAME)); executeNet(format("SELECT * FROM %s.%s WHERE v2 = 5", KS_NAME, VT1_NAME));
} }
@Test @Test
public void testAllowedFilteringOnClusteringColumn() throws Throwable public void testAllowedFilteringOnClusteringColumn()
{ {
executeNet(format("SELECT * FROM %s.%s WHERE c = 'abc'", KS_NAME, VT1_NAME)); executeNet(format("SELECT * FROM %s.%s WHERE c = 'abc'", KS_NAME, VT1_NAME));
} }