mirror of https://github.com/apache/cassandra
Don't start MessagingService unnecessarily to speed up tests and to avoid memory leak
Patch by marcuse; reviewed by Alex Petrov for CASSANDRA-19125
This commit is contained in:
parent
1df9148ed1
commit
1a46e96890
|
|
@ -246,9 +246,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean,
|
|||
{
|
||||
try
|
||||
{
|
||||
//wait on messaging service to start listening
|
||||
MessagingService.instance().waitUntilListening();
|
||||
|
||||
taskLock.lock();
|
||||
|
||||
/* Update the local heartbeat counter. */
|
||||
|
|
|
|||
|
|
@ -739,14 +739,6 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
|
|||
|
||||
Schema.instance.saveSystemKeyspace();
|
||||
DatabaseDescriptor.getInternodeAuthenticator().setupInternode();
|
||||
try
|
||||
{
|
||||
MessagingService.instance().waitUntilListening();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
throw new RuntimeException("Could not finish waiting until listening", e);
|
||||
}
|
||||
|
||||
if (ClusterMetadataService.state() == ClusterMetadataService.State.GOSSIP)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ import static java.util.concurrent.TimeUnit.MINUTES;
|
|||
import static org.apache.cassandra.concurrent.ExecutorFactory.Global.executorFactory;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.CONSISTENT_RANGE_MOVEMENT;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.CONSISTENT_SIMULTANEOUS_MOVES_ALLOW;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.GOSSIP_SETTLE_MIN_WAIT_MS;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.GOSSIP_SETTLE_POLL_INTERVAL_MS;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.RING_DELAY;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.TEST_CASSANDRA_SUITENAME;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.TEST_CASSANDRA_TESTTAG;
|
||||
|
|
@ -678,6 +680,8 @@ public class Instance extends IsolatedExecutor implements IInvokableInstance
|
|||
{
|
||||
// TODO: hacky
|
||||
RING_DELAY.setLong(15000);
|
||||
GOSSIP_SETTLE_MIN_WAIT_MS.setLong(1000);
|
||||
GOSSIP_SETTLE_POLL_INTERVAL_MS.setLong(300);
|
||||
CONSISTENT_RANGE_MOVEMENT.setBoolean(false);
|
||||
CONSISTENT_SIMULTANEOUS_MOVES_ALLOW.setBoolean(true);
|
||||
}
|
||||
|
|
@ -712,14 +716,7 @@ public class Instance extends IsolatedExecutor implements IInvokableInstance
|
|||
() -> {
|
||||
if (config.has(NETWORK))
|
||||
{
|
||||
try
|
||||
{
|
||||
MessagingService.instance().waitUntilListening();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import harry.model.sut.SystemUnderTest;
|
|||
import harry.visitors.*;
|
||||
import org.apache.cassandra.distributed.Cluster;
|
||||
import org.apache.cassandra.distributed.api.ConsistencyLevel;
|
||||
import org.apache.cassandra.distributed.api.Feature;
|
||||
import org.apache.cassandra.distributed.api.IInvokableInstance;
|
||||
import org.apache.cassandra.distributed.api.TokenSupplier;
|
||||
import org.apache.cassandra.distributed.fuzz.HarryHelper;
|
||||
|
|
@ -68,6 +69,7 @@ public class ConsistentLeaveTest extends FuzzTestBase
|
|||
try (Cluster cluster = builder().withNodes(3)
|
||||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(3))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(3, "dc0", "rack0"))
|
||||
.appendConfig(c -> c.with(Feature.NETWORK))
|
||||
.start())
|
||||
{
|
||||
IInvokableInstance cmsInstance = cluster.get(1);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import harry.visitors.MutatingVisitor;
|
|||
import harry.visitors.Visitor;
|
||||
import org.apache.cassandra.distributed.Cluster;
|
||||
import org.apache.cassandra.distributed.api.ConsistencyLevel;
|
||||
import org.apache.cassandra.distributed.api.Feature;
|
||||
import org.apache.cassandra.distributed.api.IInvokableInstance;
|
||||
import org.apache.cassandra.distributed.api.TokenSupplier;
|
||||
import org.apache.cassandra.distributed.fuzz.HarryHelper;
|
||||
|
|
@ -71,6 +72,7 @@ public class ConsistentMoveTest extends FuzzTestBase
|
|||
try (Cluster cluster = builder().withNodes(3)
|
||||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(3))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(3, "dc0", "rack0"))
|
||||
.appendConfig(c -> c.with(Feature.NETWORK))
|
||||
.start())
|
||||
{
|
||||
IInvokableInstance cmsInstance = cluster.get(1);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import net.bytebuddy.implementation.MethodDelegation;
|
|||
import net.bytebuddy.implementation.bind.annotation.SuperCall;
|
||||
import org.apache.cassandra.distributed.Cluster;
|
||||
import org.apache.cassandra.distributed.api.ConsistencyLevel;
|
||||
import org.apache.cassandra.distributed.api.Feature;
|
||||
import org.apache.cassandra.distributed.api.IInvokableInstance;
|
||||
import org.apache.cassandra.distributed.fuzz.HarryHelper;
|
||||
import org.apache.cassandra.distributed.fuzz.InJVMTokenAwareVisitorExecutor;
|
||||
|
|
@ -95,6 +96,7 @@ public class FailedLeaveTest extends FuzzTestBase
|
|||
|
||||
try (Cluster cluster = builder().withNodes(3)
|
||||
.withInstanceInitializer(BB::install)
|
||||
.appendConfig(c -> c.with(Feature.NETWORK))
|
||||
.start())
|
||||
{
|
||||
IInvokableInstance cmsInstance = cluster.get(1);
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ import org.apache.cassandra.distributed.test.TestBaseImpl;
|
|||
import org.apache.cassandra.locator.ReplicationFactor;
|
||||
|
||||
import static harry.model.SelectHelper.resultSetToRow;
|
||||
import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
|
||||
import static org.apache.cassandra.distributed.api.Feature.NETWORK;
|
||||
|
||||
public class FuzzTestBase extends TestBaseImpl
|
||||
{
|
||||
|
|
@ -57,8 +55,7 @@ public class FuzzTestBase extends TestBaseImpl
|
|||
@Override
|
||||
public Cluster.Builder builder() {
|
||||
return super.builder()
|
||||
.withConfig(cfg -> cfg.with(GOSSIP, NETWORK)
|
||||
.set("cms_default_max_retries", Integer.MAX_VALUE)
|
||||
.withConfig(cfg -> cfg.set("cms_default_max_retries", Integer.MAX_VALUE)
|
||||
.set("cms_default_retry_backoff", "1000ms")
|
||||
// Since we'll be pausing the commit request, it may happen that it won't get
|
||||
// unpaused before event expiration.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ public class InProgressSequenceCoordinationTest extends FuzzTestBase
|
|||
try (Cluster cluster = builder().withNodes(3)
|
||||
.appendConfig(cfg -> cfg.set("progress_barrier_timeout", "5000ms")
|
||||
.set("request_timeout", "1000ms")
|
||||
.set("progress_barrier_backoff", "100ms"))
|
||||
.set("progress_barrier_backoff", "100ms")
|
||||
.with(Feature.NETWORK, Feature.GOSSIP))
|
||||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(4))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(4, "dc0", "rack0"))
|
||||
.start())
|
||||
|
|
@ -128,7 +129,8 @@ public class InProgressSequenceCoordinationTest extends FuzzTestBase
|
|||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(4))
|
||||
.appendConfig(cfg -> cfg.set("progress_barrier_timeout", "5000ms")
|
||||
.set("request_timeout", "1000ms")
|
||||
.set("progress_barrier_backoff", "100ms"))
|
||||
.set("progress_barrier_backoff", "100ms")
|
||||
.with(Feature.NETWORK, Feature.GOSSIP))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(4, "dc0", "rack0"))
|
||||
.start())
|
||||
{
|
||||
|
|
@ -196,7 +198,8 @@ public class InProgressSequenceCoordinationTest extends FuzzTestBase
|
|||
try (Cluster cluster = builder().withNodes(3)
|
||||
.appendConfig(cfg -> cfg.set("progress_barrier_timeout", "5000ms")
|
||||
.set("request_timeout", "1000ms")
|
||||
.set("progress_barrier_backoff", "100ms"))
|
||||
.set("progress_barrier_backoff", "100ms")
|
||||
.with(Feature.NETWORK, Feature.GOSSIP))
|
||||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(4))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(4, "dc0", "rack0"))
|
||||
.start())
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public class ResumableStartupTest extends FuzzTestBase
|
|||
try (Cluster cluster = builder().withNodes(1)
|
||||
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(4))
|
||||
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(4, "dc0", "rack0"))
|
||||
.appendConfig(c -> c.with(Feature.NETWORK, Feature.GOSSIP))
|
||||
.createWithoutStarting())
|
||||
{
|
||||
IInvokableInstance cmsInstance = cluster.get(1);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import org.apache.cassandra.distributed.Cluster;
|
||||
import org.apache.cassandra.distributed.api.Feature;
|
||||
import org.apache.cassandra.distributed.test.log.FuzzTestBase;
|
||||
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||
import org.apache.cassandra.tcm.ClusterMetadata;
|
||||
|
|
@ -57,7 +58,7 @@ public class CMSMembershipTest extends FuzzTestBase
|
|||
@Test
|
||||
public void expandCmsTest() throws Throwable
|
||||
{
|
||||
try (Cluster cluster = builder().withNodes(3).start())
|
||||
try (Cluster cluster = builder().withNodes(3).withConfig(c -> c.with(Feature.NETWORK)).start())
|
||||
{
|
||||
cluster.get(1).runOnInstance(() -> {
|
||||
ClusterMetadata metadata = ClusterMetadata.current();
|
||||
|
|
@ -90,7 +91,8 @@ public class CMSMembershipTest extends FuzzTestBase
|
|||
@Test
|
||||
public void shrinkCmsTest() throws Throwable
|
||||
{
|
||||
try (Cluster cluster = builder().withNodes(3).start())
|
||||
try (Cluster cluster = builder().withNodes(3)
|
||||
.appendConfig(c -> c.with(Feature.NETWORK)).start())
|
||||
{
|
||||
cluster.get(1).runOnInstance(() -> {
|
||||
try
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public abstract class DecommissionAvoidTimeouts extends TestBaseImpl
|
|||
try (Cluster cluster = Cluster.build(8)
|
||||
.withRacks(2, 4)
|
||||
.withInstanceInitializer(new BB())
|
||||
.withConfig(c -> c.with(Feature.GOSSIP)
|
||||
.withConfig(c -> c.with(Feature.GOSSIP, Feature.NETWORK)
|
||||
.set("transfer_hints_on_decommission", false)
|
||||
.set("severity_during_decommission", 10000D)
|
||||
.set("dynamic_snitch_badness_threshold", 0))
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.apache.cassandra.exceptions.InvalidRequestException;
|
|||
import org.apache.cassandra.io.sstable.CQLSSTableWriter;
|
||||
import org.apache.cassandra.io.sstable.SSTableLoader;
|
||||
import org.apache.cassandra.locator.Replica;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.CompressionParams;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
import org.apache.cassandra.schema.TableMetadataRef;
|
||||
|
|
@ -57,6 +58,7 @@ public class LongStreamingTest
|
|||
ServerTestUtils.prepareServerNoRegister();
|
||||
|
||||
Keyspace.setInitialized();
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
|
||||
StorageService.instance.setCompactionThroughputMbPerSec(0);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.apache.cassandra.config.Config;
|
|||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.exceptions.AuthenticationException;
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.SchemaConstants;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.MBeanWrapper;
|
||||
|
|
@ -72,6 +73,7 @@ public class MutualTlsAuthenticatorTest
|
|||
public static void setup()
|
||||
{
|
||||
SchemaLoader.prepareServer();
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
((CassandraRoleManager)DatabaseDescriptor.getRoleManager()).loadIdentityStatement();
|
||||
final Config config = DatabaseDescriptor.getRawConfig();
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ import org.apache.cassandra.io.util.FileUtils;
|
|||
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||
import org.apache.cassandra.metrics.CassandraMetricsRegistry;
|
||||
import org.apache.cassandra.metrics.ClientMetrics;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.IndexMetadata;
|
||||
import org.apache.cassandra.schema.KeyspaceMetadata;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
|
|
@ -559,6 +560,7 @@ public abstract class CQLTester
|
|||
private static void startServices()
|
||||
{
|
||||
VirtualKeyspaceRegistry.instance.register(VirtualSchemaKeyspace.instance);
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
SchemaLoader.startGossiper();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import org.apache.cassandra.db.commitlog.CommitLog;
|
|||
import org.apache.cassandra.db.marshal.UTF8Type;
|
||||
import org.apache.cassandra.dht.*;
|
||||
import org.apache.cassandra.exceptions.*;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
import org.apache.cassandra.schema.TableMetadataRef;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
|
|
@ -87,6 +88,7 @@ public class CQLSSTableWriterTest
|
|||
SchemaLoader.cleanupAndLeaveDirs();
|
||||
Keyspace.setInitialized();
|
||||
ServerTestUtils.prepareServerNoRegister();
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ import org.apache.cassandra.io.sstable.format.big.BigFormat;
|
|||
import org.apache.cassandra.io.util.File;
|
||||
import org.apache.cassandra.io.util.FileInputStreamPlus;
|
||||
import org.apache.cassandra.io.util.FileOutputStreamPlus;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.service.CacheService;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.streaming.OutgoingStream;
|
||||
|
|
@ -128,8 +129,8 @@ public class LegacySSTableTest
|
|||
|
||||
LEGACY_SSTABLE_ROOT = new File(scp).toAbsolute();
|
||||
Assert.assertTrue("System property " + LEGACY_SSTABLE_ROOT + " does not specify a directory", LEGACY_SSTABLE_ROOT.isDirectory());
|
||||
|
||||
ServerTestUtils.prepareServerNoRegister();
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
Keyspace.setInitialized();
|
||||
createKeyspace();
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import org.apache.cassandra.db.marshal.AsciiType;
|
|||
import org.apache.cassandra.db.partitions.FilteredPartition;
|
||||
import org.apache.cassandra.io.FSWriteError;
|
||||
import org.apache.cassandra.locator.Replica;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.KeyspaceParams;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
import org.apache.cassandra.schema.TableId;
|
||||
|
|
@ -96,7 +97,7 @@ public class SSTableLoaderTest
|
|||
KeyspaceParams.simple(1),
|
||||
SchemaLoader.standardCFMD(KEYSPACE2, CF_STANDARD1),
|
||||
SchemaLoader.standardCFMD(KEYSPACE2, CF_STANDARD2));
|
||||
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.apache.cassandra.SchemaLoader;
|
|||
import org.apache.cassandra.Util;
|
||||
import org.apache.cassandra.db.streaming.CassandraOutgoingFile;
|
||||
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.TableMetadata;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.cql3.QueryProcessor;
|
||||
|
|
@ -88,6 +89,7 @@ public class StreamingTransferTest
|
|||
public static void defineSchema() throws Exception
|
||||
{
|
||||
SchemaLoader.prepareServer();
|
||||
MessagingService.instance().waitUntilListeningUnchecked();
|
||||
StorageService.instance.initServer();
|
||||
|
||||
createKeyspace(KEYSPACE1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue