From 9135340a13531930f26fb8175b057342791ff044 Mon Sep 17 00:00:00 2001 From: Carl Yeksigian Date: Thu, 8 Oct 2015 12:13:28 -0400 Subject: [PATCH] Warn if system_traces not available for CASSANDRA-9628 --- .../cassandra/service/StorageService.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 0d9e9ef571..0698d11592 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -4004,28 +4004,32 @@ public class StorageService extends NotificationBroadcasterSupport implements IE if (keyspace != null) { - Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace); - if(keyspaceInstance == null) - throw new IllegalArgumentException("The keyspace " + keyspace + ", does not exist"); + Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace); + if(keyspaceInstance == null) + throw new IllegalArgumentException("The keyspace " + keyspace + ", does not exist"); - if(keyspaceInstance.getReplicationStrategy() instanceof LocalStrategy) - throw new IllegalStateException("Ownership values for keyspaces with LocalStrategy are meaningless"); + if(keyspaceInstance.getReplicationStrategy() instanceof LocalStrategy) + throw new IllegalStateException("Ownership values for keyspaces with LocalStrategy are meaningless"); } else { - List nonSystemKeyspaces = Schema.instance.getNonSystemKeyspaces(); + List nonSystemKeyspaces = Schema.instance.getNonSystemKeyspaces(); - //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")) - { - specialTableCount += 1; - } - if (nonSystemKeyspaces.size() > specialTableCount) - throw new IllegalStateException("Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless"); + //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")) + { + specialTableCount += 1; + } + 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 = "system_traces"; + + Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace); + if(keyspaceInstance == null) + throw new IllegalArgumentException("The node does not have " + keyspace + " yet, probably still bootstrapping"); + } TokenMetadata metadata = tokenMetadata.cloneOnlyTokenMap();