diff --git a/CHANGES.txt b/CHANGES.txt index d4baa8758c..8a80f4c4fb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.1.4 + * Fixed the inconsistency between distributedKeyspaces and distributedAndLocalKeyspaces (CASSANDRA-18747) * Internode legacy SSL storage port certificate is not hot reloaded on update (CASSANDRA-18681) * Nodetool paxos-only repair is no longer incremental (CASSANDRA-18466) * Waiting indefinitely on ReceivedMessage response in StreamSession#receive() can cause deadlock (CASSANDRA-18733) diff --git a/src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java b/src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java index 6760502c3c..ed8c4155e5 100644 --- a/src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java @@ -132,11 +132,12 @@ public abstract class DescribeStatement extends CQLStatement.Raw implements C @Override public ResultMessage executeLocally(QueryState state, QueryOptions options) { - Keyspaces keyspaces = Schema.instance.distributedAndLocalKeyspaces(); + Keyspaces keyspaces = Schema.instance.distributedKeyspaces(); UUID schemaVersion = Schema.instance.getVersion(); keyspaces = Keyspaces.builder() .add(keyspaces) + .add(Schema.instance.getLocalKeyspaces()) .add(VirtualKeyspaceRegistry.instance.virtualKeyspacesMetadata()) .build(); diff --git a/src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java b/src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java index 3799178747..f204b8e023 100644 --- a/src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java @@ -140,7 +140,6 @@ public final class CreateTableStatement extends AlterSchemaStatement { int totalUserTables = Schema.instance.getUserKeyspaces() .stream() - .map(ksm -> ksm.name) .map(Keyspace::open) .mapToInt(keyspace -> keyspace.getColumnFamilyStores().size()) .sum(); diff --git a/src/java/org/apache/cassandra/db/Keyspace.java b/src/java/org/apache/cassandra/db/Keyspace.java index d6db700519..01d731e058 100644 --- a/src/java/org/apache/cassandra/db/Keyspace.java +++ b/src/java/org/apache/cassandra/db/Keyspace.java @@ -768,14 +768,9 @@ public class Keyspace return Schema.instance.getKeyspaces().stream().map(Schema.instance::getKeyspaceInstance).filter(Objects::nonNull); } - public static Iterable nonSystem() - { - return Iterables.transform(Schema.instance.getNonSystemKeyspaces().names(), Keyspace::open); - } - public static Iterable nonLocalStrategy() { - return Iterables.transform(Schema.instance.getNonLocalStrategyKeyspaces().names(), Keyspace::open); + return Iterables.transform(Schema.instance.distributedKeyspaces().names(), Keyspace::open); } public static Iterable system() diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java index b84555fbf1..c4dd779f3f 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@ -1257,7 +1257,7 @@ public class CompactionManager implements CompactionManagerMBean /* Used in tests. */ public void disableAutoCompaction() { - for (String ksname : Schema.instance.getNonSystemKeyspaces().names()) + for (String ksname : Schema.instance.distributedKeyspaces().names()) { for (ColumnFamilyStore cfs : Keyspace.open(ksname).getColumnFamilyStores()) cfs.disableAutoCompaction(); diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java index 9b017c6124..5d5529e15f 100644 --- a/src/java/org/apache/cassandra/dht/BootStrapper.java +++ b/src/java/org/apache/cassandra/dht/BootStrapper.java @@ -73,7 +73,7 @@ public class BootStrapper extends ProgressEventNotifierSupport stateStore, true, DatabaseDescriptor.getStreamingConnectionsPerHost()); - final Collection nonLocalStrategyKeyspaces = Schema.instance.getNonLocalStrategyKeyspaces().names(); + final Collection nonLocalStrategyKeyspaces = Schema.instance.distributedKeyspaces().names(); if (nonLocalStrategyKeyspaces.isEmpty()) logger.debug("Schema does not contain any non-local keyspaces to stream on bootstrap"); for (String keyspaceName : nonLocalStrategyKeyspaces) diff --git a/src/java/org/apache/cassandra/metrics/TableMetrics.java b/src/java/org/apache/cassandra/metrics/TableMetrics.java index 5e7ab78b29..24c4b16153 100644 --- a/src/java/org/apache/cassandra/metrics/TableMetrics.java +++ b/src/java/org/apache/cassandra/metrics/TableMetrics.java @@ -280,7 +280,7 @@ public class TableMetrics { long total = 0; long filtered = 0; - for (String keyspace : Schema.instance.getNonSystemKeyspaces().names()) + for (String keyspace : Schema.instance.distributedKeyspaces().names()) { Keyspace k = Schema.instance.getKeyspaceInstance(keyspace); diff --git a/src/java/org/apache/cassandra/repair/consistent/admin/SchemaArgsParser.java b/src/java/org/apache/cassandra/repair/consistent/admin/SchemaArgsParser.java index bfcc8cdae7..58db71406f 100644 --- a/src/java/org/apache/cassandra/repair/consistent/admin/SchemaArgsParser.java +++ b/src/java/org/apache/cassandra/repair/consistent/admin/SchemaArgsParser.java @@ -73,7 +73,7 @@ public class SchemaArgsParser implements Iterable if (schemaArgs.isEmpty()) { // iterate over everything - Iterator ksNames = Schema.instance.getNonLocalStrategyKeyspaces().names().iterator(); + Iterator ksNames = Schema.instance.distributedKeyspaces().names().iterator(); return new AbstractIterator() { diff --git a/src/java/org/apache/cassandra/schema/Schema.java b/src/java/org/apache/cassandra/schema/Schema.java index 0dba167210..7d49f5d946 100644 --- a/src/java/org/apache/cassandra/schema/Schema.java +++ b/src/java/org/apache/cassandra/schema/Schema.java @@ -18,20 +18,34 @@ package org.apache.cassandra.schema; import java.time.Duration; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.MapDifference; +import com.google.common.collect.Sets; +import com.google.common.collect.Streams; import org.apache.commons.lang3.ObjectUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.cassandra.config.CassandraRelevantProperties; -import org.apache.cassandra.cql3.functions.*; -import org.apache.cassandra.db.*; +import org.apache.cassandra.cql3.functions.Function; +import org.apache.cassandra.cql3.functions.FunctionName; +import org.apache.cassandra.db.ColumnFamilyStore; +import org.apache.cassandra.db.Keyspace; +import org.apache.cassandra.db.KeyspaceNotDefinedException; +import org.apache.cassandra.db.SystemKeyspace; import org.apache.cassandra.db.marshal.AbstractType; import org.apache.cassandra.db.virtual.VirtualKeyspaceRegistry; import org.apache.cassandra.exceptions.ConfigurationException; @@ -49,9 +63,6 @@ import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.concurrent.Awaitable; import org.apache.cassandra.utils.concurrent.LoadingMap; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import static com.google.common.collect.Iterables.size; import static java.lang.String.format; import static org.apache.cassandra.config.DatabaseDescriptor.isDaemonInitialized; @@ -78,7 +89,6 @@ public class Schema implements SchemaProvider public static final Schema instance = new Schema(); private volatile Keyspaces distributedKeyspaces = Keyspaces.none(); - private volatile Keyspaces distributedAndLocalKeyspaces; private final Keyspaces localKeyspaces; @@ -110,7 +120,6 @@ public class Schema implements SchemaProvider this.localKeyspaces = (CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.getBoolean() || isDaemonInitialized() || isToolInitialized()) ? Keyspaces.of(SchemaKeyspace.metadata(), SystemKeyspace.metadata()) : Keyspaces.none(); - this.distributedAndLocalKeyspaces = this.localKeyspaces; this.localKeyspaces.forEach(this::loadNew); this.updateHandler = SchemaUpdateHandlerFactoryProvider.instance.get().getSchemaUpdateHandler(online, this::mergeAndUpdateVersion); @@ -121,7 +130,6 @@ public class Schema implements SchemaProvider { this.online = online; this.localKeyspaces = localKeyspaces; - this.distributedAndLocalKeyspaces = this.localKeyspaces; this.updateHandler = updateHandler; } @@ -163,7 +171,6 @@ public class Schema implements SchemaProvider reload(previous, ksm); distributedKeyspaces = distributedKeyspaces.withAddedOrUpdated(ksm); - distributedAndLocalKeyspaces = distributedAndLocalKeyspaces.withAddedOrUpdated(ksm); } private synchronized void loadNew(KeyspaceMetadata ksm) @@ -246,11 +253,6 @@ public class Schema implements SchemaProvider } } - public Keyspaces distributedAndLocalKeyspaces() - { - return distributedAndLocalKeyspaces; - } - public Keyspaces distributedKeyspaces() { return distributedKeyspaces; @@ -262,11 +264,11 @@ public class Schema implements SchemaProvider */ public int largestGcgs() { - return distributedAndLocalKeyspaces().stream() - .flatMap(ksm -> ksm.tables.stream()) - .mapToInt(tm -> tm.params.gcGraceSeconds) - .max() - .orElse(Integer.MIN_VALUE); + return Streams.concat(distributedKeyspaces.stream(), localKeyspaces.stream()) + .flatMap(ksm -> ksm.tables.stream()) + .mapToInt(tm -> tm.params.gcGraceSeconds) + .max() + .orElse(Integer.MIN_VALUE); } /** @@ -277,7 +279,6 @@ public class Schema implements SchemaProvider private synchronized void unload(KeyspaceMetadata ksm) { distributedKeyspaces = distributedKeyspaces.without(ksm.name); - distributedAndLocalKeyspaces = distributedAndLocalKeyspaces.without(ksm.name); this.tableMetadataRefCache = tableMetadataRefCache.withRemovedRefs(ksm); @@ -286,13 +287,16 @@ public class Schema implements SchemaProvider public int getNumberOfTables() { - return distributedAndLocalKeyspaces().stream().mapToInt(k -> size(k.tablesAndViews())).sum(); + return Streams.concat(distributedKeyspaces.stream(), localKeyspaces.stream()) + .mapToInt(k -> size(k.tablesAndViews())) + .sum(); } public ViewMetadata getView(String keyspaceName, String viewName) { assert keyspaceName != null; - KeyspaceMetadata ksm = distributedAndLocalKeyspaces().getNullable(keyspaceName); + KeyspaceMetadata ksm = distributedKeyspaces.getNullable(keyspaceName); + ksm = ksm != null ? ksm : localKeyspaces.getNullable(keyspaceName); return (ksm == null) ? null : ksm.views.getNullable(viewName); } @@ -307,36 +311,18 @@ public class Schema implements SchemaProvider public KeyspaceMetadata getKeyspaceMetadata(String keyspaceName) { assert keyspaceName != null; - KeyspaceMetadata keyspace = distributedAndLocalKeyspaces().getNullable(keyspaceName); - return null != keyspace ? keyspace : VirtualKeyspaceRegistry.instance.getKeyspaceMetadataNullable(keyspaceName); - } - - /** - * Returns all non-local keyspaces, that is, all but {@link SchemaConstants#LOCAL_SYSTEM_KEYSPACE_NAMES} - * or virtual keyspaces. - * @deprecated use {@link #distributedKeyspaces()} - */ - @Deprecated - public Keyspaces getNonSystemKeyspaces() - { - return distributedKeyspaces; - } - - /** - * Returns all non-local keyspaces whose replication strategy is not {@link LocalStrategy}. - */ - public Keyspaces getNonLocalStrategyKeyspaces() - { - return distributedKeyspaces.filter(keyspace -> keyspace.params.replication.klass != LocalStrategy.class); + KeyspaceMetadata ksm = distributedKeyspaces.getNullable(keyspaceName); + ksm = ksm != null ? ksm : localKeyspaces.getNullable(keyspaceName); + return null != ksm ? ksm : VirtualKeyspaceRegistry.instance.getKeyspaceMetadataNullable(keyspaceName); } /** * Returns user keyspaces, that is all but {@link SchemaConstants#LOCAL_SYSTEM_KEYSPACE_NAMES}, * {@link SchemaConstants#REPLICATED_SYSTEM_KEYSPACE_NAMES} or virtual keyspaces. */ - public Keyspaces getUserKeyspaces() + public Sets.SetView getUserKeyspaces() { - return distributedKeyspaces.without(SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES); + return Sets.difference(distributedKeyspaces.names(), SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES); } /** @@ -355,11 +341,11 @@ public class Schema implements SchemaProvider } /** - * @return collection of the all keyspace names registered in the system (system and non-system) + * @return a set of local and distributed keyspace names; it does not include virtual keyspaces */ - public ImmutableSet getKeyspaces() + public Sets.SetView getKeyspaces() { - return distributedAndLocalKeyspaces().names(); + return Sets.union(distributedKeyspaces.names(), localKeyspaces.names()); } public Keyspaces getLocalKeyspaces() @@ -588,6 +574,7 @@ public class Schema implements SchemaProvider public synchronized void mergeAndUpdateVersion(SchemaTransformationResult result, boolean dropData) { result = localDiff(result); + assert result.after.getKeyspaces().stream().noneMatch(ksm -> ksm.params.replication.klass == LocalStrategy.class) : "LocalStrategy should not be used"; schemaChangeNotifier.notifyPreChanges(result); merge(result.diff, dropData); updateVersion(result.after.getVersion()); diff --git a/src/java/org/apache/cassandra/schema/SchemaEvent.java b/src/java/org/apache/cassandra/schema/SchemaEvent.java index 5703fe29b5..8e6505cc53 100644 --- a/src/java/org/apache/cassandra/schema/SchemaEvent.java +++ b/src/java/org/apache/cassandra/schema/SchemaEvent.java @@ -101,9 +101,9 @@ public final class SchemaEvent extends DiagnosticEvent this.viewsDiff = viewsDiff; this.indexesDiff = indexesDiff; - this.keyspaces = schema.distributedAndLocalKeyspaces().names(); + this.keyspaces = schema.getKeyspaces().immutableCopy(); this.nonSystemKeyspaces = schema.distributedKeyspaces().names(); - this.userKeyspaces = schema.getUserKeyspaces().names(); + this.userKeyspaces = schema.getUserKeyspaces().immutableCopy(); this.numberOfTables = schema.getNumberOfTables(); this.version = schema.getVersion(); diff --git a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java index 837bdd882e..cd096a888e 100644 --- a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java +++ b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java @@ -53,7 +53,7 @@ public class PendingRangeCalculatorService private final AtLeastOnceTrigger update = executor.atLeastOnceTrigger(() -> { PendingRangeCalculatorServiceDiagnostics.taskStarted(1); long start = currentTimeMillis(); - Collection keyspaces = Schema.instance.getNonLocalStrategyKeyspaces().names(); + Collection keyspaces = Schema.instance.distributedKeyspaces().names(); for (String keyspaceName : keyspaces) calculatePendingRanges(Keyspace.open(keyspaceName).getReplicationStrategy(), keyspaceName); if (logger.isTraceEnabled()) diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index e70406682e..5b8531331c 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1295,7 +1295,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE private void executePreJoinTasks(boolean bootstrap) { StreamSupport.stream(ColumnFamilyStore.all().spliterator(), false) - .filter(cfs -> Schema.instance.getUserKeyspaces().names().contains(cfs.keyspace.getName())) + .filter(cfs -> Schema.instance.getUserKeyspaces().contains(cfs.keyspace.getName())) .forEach(cfs -> cfs.indexManager.executePreJoinTasksBlocking(bootstrap)); } @@ -1407,7 +1407,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE if (keyspace == null) { - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) streamer.addRanges(keyspaceName, getLocalReplicas(keyspaceName)); } else if (tokens == null) @@ -2074,7 +2074,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE * All MVs have been created during bootstrap, so mark them as built */ private void markViewsAsBuilt() { - for (String keyspace : Schema.instance.getUserKeyspaces().names()) + for (String keyspace : Schema.instance.getUserKeyspaces()) { for (ViewMetadata view: Schema.instance.getKeyspaceMetadata(keyspace).views) SystemKeyspace.finishViewBuildStatus(view.keyspace(), view.name()); @@ -2304,7 +2304,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE // some people just want to get a visual representation of things. Allow null and set it to the first // non-system keyspace. if (keyspace == null) - keyspace = Schema.instance.getNonLocalStrategyKeyspaces().iterator().next().name; + keyspace = Schema.instance.distributedKeyspaces().iterator().next().name; Map, List> map = new HashMap<>(); for (Map.Entry, EndpointsForRange> entry : tokenMetadata.getPendingRangesMM(keyspace).asMap().entrySet()) @@ -2358,7 +2358,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE // some people just want to get a visual representation of things. Allow null and set it to the first // non-system keyspace. if (keyspace == null) - keyspace = Schema.instance.getNonLocalStrategyKeyspaces().iterator().next().name; + keyspace = Schema.instance.distributedKeyspaces().iterator().next().name; List> ranges = getAllRanges(sortedTokens); return constructRangeToEndpointMap(keyspace, ranges); @@ -3462,7 +3462,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE InetAddressAndPort myAddress = FBUtilities.getBroadcastAddressAndPort(); - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { logger.debug("Restoring replica count for keyspace {}", keyspaceName); EndpointsByReplica changedReplicas = getChangedReplicasForLeaving(keyspaceName, endpoint, tokenMetadata, Keyspace.open(keyspaceName).getReplicationStrategy()); @@ -4601,7 +4601,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE List> futures = new ArrayList<>(); - Keyspaces keyspaces = Schema.instance.getNonLocalStrategyKeyspaces(); + Keyspaces keyspaces = Schema.instance.distributedKeyspaces(); for (String ksName : keyspaces.names()) { if (SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES.contains(ksName)) @@ -4952,7 +4952,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE if (operationMode != Mode.LEAVING) // If we're already decommissioning there is no point checking RF/pending ranges { int rf, numNodes; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { if (!force) { @@ -5040,7 +5040,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE { Map rangesToStream = new HashMap<>(); - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { EndpointsByReplica rangesMM = getChangedReplicasForLeaving(keyspaceName, FBUtilities.getBroadcastAddressAndPort(), tokenMetadata, Keyspace.open(keyspaceName).getReplicationStrategy()); @@ -5154,7 +5154,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE throw new UnsupportedOperationException("This node has more than one token and cannot be moved thusly."); } - List keyspacesToProcess = ImmutableList.copyOf(Schema.instance.getNonLocalStrategyKeyspaces().names()); + List keyspacesToProcess = ImmutableList.copyOf(Schema.instance.distributedKeyspaces().names()); PendingRangeCalculatorService.instance.blockUntilFinished(); // checking if data is moving to this node @@ -5301,7 +5301,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE Collection tokens = tokenMetadata.getTokens(endpoint); // Find the endpoints that are going to become responsible for data - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { // if the replication factor is 1 the data is lost so we shouldn't wait for confirmation if (Keyspace.open(keyspaceName).getReplicationStrategy().getReplicationFactor().allReplicas == 1) @@ -5485,12 +5485,12 @@ public class StorageService extends NotificationBroadcasterSupport implements IE // count CFs first, since forceFlush could block for the flushWriter to get a queue slot empty totalCFs = 0; - for (Keyspace keyspace : Keyspace.nonSystem()) + for (Keyspace keyspace : Keyspace.nonLocalStrategy()) totalCFs += keyspace.getColumnFamilyStores().size(); remainingCFs = totalCFs; // flush List> flushes = new ArrayList<>(); - for (Keyspace keyspace : Keyspace.nonSystem()) + for (Keyspace keyspace : Keyspace.nonLocalStrategy()) { for (ColumnFamilyStore cfs : keyspace.getColumnFamilyStores()) flushes.add(cfs.forceFlush(ColumnFamilyStore.FlushReason.DRAIN)); @@ -5734,9 +5734,9 @@ public class StorageService extends NotificationBroadcasterSupport implements IE } else { - Collection userKeyspaces = Schema.instance.getUserKeyspaces().names(); + Collection userKeyspaces = Schema.instance.getUserKeyspaces(); - if (userKeyspaces.size() > 0) + if (!userKeyspaces.isEmpty()) { keyspace = userKeyspaces.iterator().next(); AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy(); @@ -5805,7 +5805,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE public List getKeyspaces() { - return Lists.newArrayList(Schema.instance.distributedAndLocalKeyspaces().names()); + return Lists.newArrayList(Schema.instance.getKeyspaces()); } public List getNonSystemKeyspaces() @@ -5815,7 +5815,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE public List getNonLocalStrategyKeyspaces() { - return Lists.newArrayList(Schema.instance.getNonLocalStrategyKeyspaces().names()); + return Lists.newArrayList(Schema.instance.distributedKeyspaces().names()); } public Map getViewBuildStatuses(String keyspace, String view, boolean withPort) diff --git a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java index 395ff4072f..f23e50521a 100644 --- a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java +++ b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java @@ -74,7 +74,7 @@ public class BootStrapperTest public void testSourceTargetComputation() throws UnknownHostException { final int[] clusterSizes = new int[] { 1, 3, 5, 10, 100}; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { int replicationFactor = Keyspace.open(keyspaceName).getReplicationStrategy().getReplicationFactor().allReplicas; for (int clusterSize : clusterSizes) diff --git a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java index ca4841dfe8..a4cbcf4385 100644 --- a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java +++ b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java @@ -159,7 +159,7 @@ public class SimpleStrategyTest { TokenMetadata tmd; AbstractReplicationStrategy strategy; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { tmd = new TokenMetadata(); strategy = getStrategy(keyspaceName, tmd, new SimpleSnitch()); @@ -214,7 +214,7 @@ public class SimpleStrategyTest tmd.addBootstrapToken(bsToken, bootstrapEndpoint); AbstractReplicationStrategy strategy = null; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { strategy = getStrategy(keyspaceName, tmd, new SimpleSnitch()); diff --git a/test/unit/org/apache/cassandra/schema/SchemaKeyspaceTest.java b/test/unit/org/apache/cassandra/schema/SchemaKeyspaceTest.java index e80773047a..0d50a198b9 100644 --- a/test/unit/org/apache/cassandra/schema/SchemaKeyspaceTest.java +++ b/test/unit/org/apache/cassandra/schema/SchemaKeyspaceTest.java @@ -138,7 +138,7 @@ public class SchemaKeyspaceTest @Test public void testConversionsInverses() throws Exception { - for (String keyspaceName : Schema.instance.getNonSystemKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { for (ColumnFamilyStore cfs : Keyspace.open(keyspaceName).getColumnFamilyStores()) { diff --git a/test/unit/org/apache/cassandra/schema/SchemaTest.java b/test/unit/org/apache/cassandra/schema/SchemaTest.java index 4185536e68..1c8dc47c28 100644 --- a/test/unit/org/apache/cassandra/schema/SchemaTest.java +++ b/test/unit/org/apache/cassandra/schema/SchemaTest.java @@ -49,7 +49,7 @@ public class SchemaTest @Test public void testTransKsMigration() throws IOException { - assertEquals(0, Schema.instance.getNonSystemKeyspaces().size()); + assertEquals(0, Schema.instance.distributedKeyspaces().size()); Gossiper.instance.start((int) (System.currentTimeMillis() / 1000)); try diff --git a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java index b6d039b439..dc022beb71 100644 --- a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java +++ b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java @@ -32,6 +32,7 @@ import org.junit.Test; import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.Util.PartitionerSwitcher; +import org.apache.cassandra.config.CassandraRelevantProperties; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.locator.InetAddressAndPort; import org.apache.cassandra.schema.Schema; @@ -62,6 +63,7 @@ public class LeaveAndBootstrapTest @BeforeClass public static void defineSchema() throws Exception { + CassandraRelevantProperties.GOSSIPER_QUARANTINE_DELAY.setLong(10000); DatabaseDescriptor.daemonInitialization(); partitionerSwitcher = Util.switchPartitioner(partitioner); SchemaLoader.loadSchema(); @@ -123,7 +125,7 @@ public class LeaveAndBootstrapTest PendingRangeCalculatorService.instance.blockUntilFinished(); AbstractReplicationStrategy strategy; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { strategy = getStrategy(keyspaceName, tmd); for (Token token : keyTokens) diff --git a/test/unit/org/apache/cassandra/service/MoveTest.java b/test/unit/org/apache/cassandra/service/MoveTest.java index 6dce8f3398..57b91b9812 100644 --- a/test/unit/org/apache/cassandra/service/MoveTest.java +++ b/test/unit/org/apache/cassandra/service/MoveTest.java @@ -557,7 +557,7 @@ public class MoveTest private void assertPendingRanges(TokenMetadata tmd, Map, EndpointsForRange> pendingRanges, String keyspaceName) throws ConfigurationException { boolean keyspaceFound = false; - for (String nonSystemKeyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String nonSystemKeyspaceName : Schema.instance.distributedKeyspaces().names()) { if(!keyspaceName.equals(nonSystemKeyspaceName)) continue; @@ -626,7 +626,7 @@ public class MoveTest assertTrue(tmd.isMoving(hosts.get(MOVING_NODE))); AbstractReplicationStrategy strategy; - for (String keyspaceName : Schema.instance.getNonLocalStrategyKeyspaces().names()) + for (String keyspaceName : Schema.instance.distributedKeyspaces().names()) { strategy = getStrategy(keyspaceName, tmd); if(strategy instanceof NetworkTopologyStrategy)