You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2016/02/17 11:32:35 UTC
[08/16] cassandra git commit: Merge commit '6f5dddd' into
cassandra-3.0
Merge commit '6f5dddd' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ce39f81d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ce39f81d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ce39f81d
Branch: refs/heads/cassandra-3.0
Commit: ce39f81d26489ba292447a18a66057980b0c3f53
Parents: 9cfbc31 6f5dddd
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Feb 17 11:25:53 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Feb 17 11:27:27 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/config/Schema.java | 28 ++++++++++++++++++--
.../locator/AbstractReplicationStrategy.java | 5 ++++
.../locator/NetworkTopologyStrategy.java | 6 +++++
.../cassandra/service/StorageService.java | 22 ++++++++-------
5 files changed, 51 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce39f81d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 52fc3ab,49bc581..32c165b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -22,6 -9,6 +22,7 @@@ Merged from 2.2
* Fix paging on DISTINCT queries repeats result when first row in partition changes
(CASSANDRA-10010)
Merged from 2.1:
++ * Fix incorrect warning in 'nodetool status' (CASSANDRA-10176)
* Properly release sstable ref when doing offline scrub (CASSANDRA-10697)
* Improve nodetool status performance for large cluster (CASSANDRA-7238)
* Gossiper#isEnabled is not thread safe (CASSANDRA-11116)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce39f81d/src/java/org/apache/cassandra/config/Schema.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/Schema.java
index 7ffa89e,2cd7611..3fd9f11
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@@ -27,18 -27,21 +27,21 @@@ import com.google.common.collect.Sets
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+ import org.apache.cassandra.auth.AuthKeyspace;
-import org.apache.cassandra.cql3.functions.Functions;
-import org.apache.cassandra.cql3.functions.UDAggregate;
-import org.apache.cassandra.cql3.functions.UDFunction;
-import org.apache.cassandra.db.*;
+import org.apache.cassandra.cql3.functions.*;
+import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.db.compaction.CompactionManager;
+import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.UserType;
-import org.apache.cassandra.db.index.SecondaryIndex;
+import org.apache.cassandra.index.Index;
import org.apache.cassandra.io.sstable.Descriptor;
-import org.apache.cassandra.schema.LegacySchemaTables;
+ import org.apache.cassandra.repair.SystemDistributedKeyspace;
+import org.apache.cassandra.schema.*;
import org.apache.cassandra.service.MigrationManager;
+ import org.apache.cassandra.tracing.TraceKeyspace;
import org.apache.cassandra.utils.ConcurrentBiMap;
import org.apache.cassandra.utils.Pair;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
@@@ -49,9 -52,6 +52,14 @@@ public class Schem
public static final Schema instance = new Schema();
+ /* system keyspace names (the ones with LocalStrategy replication strategy) */
+ public static final Set<String> SYSTEM_KEYSPACE_NAMES = ImmutableSet.of(SystemKeyspace.NAME, SchemaKeyspace.NAME);
+
++ /* replicate system keyspace names (the ones with a "true" replication strategy) */
++ public static final Set<String> REPLICATED_SYSTEM_KEYSPACE_NAMES = ImmutableSet.of(TraceKeyspace.NAME,
++ AuthKeyspace.NAME,
++ SystemDistributedKeyspace.NAME);
++
/**
* longest permissible KS or CF name. Our main concern is that filename not be more than 255 characters;
* the filename will contain both the KS and CF names. Since non-schema-name components only take up
@@@ -74,6 -74,10 +82,7 @@@
// 59adb24e-f3cd-3e02-97f0-5b395827453f
public static final UUID emptyVersion;
- private static final ImmutableSet<String> replicatedSystemKeyspaceNames = ImmutableSet.of(TraceKeyspace.NAME,
- AuthKeyspace.NAME,
- SystemDistributedKeyspace.NAME);
+
static
{
try
@@@ -323,12 -307,27 +332,27 @@@
return keyspaces.get(keyspaceName);
}
+ private Set<String> getNonSystemKeyspacesSet()
+ {
- return Sets.difference(keyspaces.keySet(), Collections.singleton(SystemKeyspace.NAME));
++ return Sets.difference(keyspaces.keySet(), SYSTEM_KEYSPACE_NAMES);
+ }
+
/**
- * @return collection of the non-system keyspaces
+ * @return collection of the non-system keyspaces (note that this count as system only the
+ * non replicated keyspaces, so keyspace like system_traces which are replicated are actually
+ * returned. See getUserKeyspace() below if you don't want those)
*/
public List<String> getNonSystemKeyspaces()
{
- return ImmutableList.copyOf(Sets.difference(keyspaces.keySet(), SYSTEM_KEYSPACE_NAMES));
+ return ImmutableList.copyOf(getNonSystemKeyspacesSet());
+ }
+
+ /**
+ * @return collection of the user defined keyspaces
+ */
+ public List<String> getUserKeyspaces()
+ {
- return ImmutableList.copyOf(Sets.difference(getNonSystemKeyspacesSet(), replicatedSystemKeyspaceNames));
++ return ImmutableList.copyOf(Sets.difference(getNonSystemKeyspacesSet(), REPLICATED_SYSTEM_KEYSPACE_NAMES));
}
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce39f81d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 7cca516,0e716e8..185c988
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -4157,18 -4045,22 +4157,22 @@@ public class StorageService extends Not
}
else
{
- List<String> nonSystemKeyspaces = Schema.instance.getNonSystemKeyspaces();
+ List<String> userKeyspaces = Schema.instance.getUserKeyspaces();
- //system_traces is a non-system keyspace however it needs to be counted as one for this process
- int specialTableCount = 0;
- if (nonSystemKeyspaces.contains("system_traces"))
+ if (userKeyspaces.size() > 0)
{
- specialTableCount += 1;
- keyspace = userKeyspaces.iterator().next();
++ keyspace = userKeyspaces.get(0);
+ AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy();
+ for (String keyspaceName : userKeyspaces)
+ {
+ if (!Schema.instance.getKeyspaceInstance(keyspaceName).getReplicationStrategy().hasSameSettings(replicationStrategy))
+ throw new IllegalStateException("Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless");
+ }
+ }
+ else
+ {
+ keyspace = "system_traces";
}
- if (nonSystemKeyspaces.size() > specialTableCount)
- throw new IllegalStateException("Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless");
-
- keyspace = "system_traces";
Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace);
if (keyspaceInstance == null)