Merge branch 'cassandra-3.0' into cassandra-3.11

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f5e8d167
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f5e8d167
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f5e8d167

Branch: refs/heads/cassandra-3.11
Commit: f5e8d1672ce4c1d83fd66955a2fc9de995ef4c04
Parents: 394fb0b 9e37967
Author: Aleksey Yeschenko <alek...@yeschenko.com>
Authored: Tue Oct 17 13:32:44 2017 +0100
Committer: Aleksey Yeschenko <alek...@yeschenko.com>
Committed: Tue Oct 17 13:32:44 2017 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/config/Schema.java     |  4 +-
 .../cassandra/config/SchemaConstants.java       | 20 ++++++---
 .../cql3/statements/AlterKeyspaceStatement.java |  2 +-
 .../apache/cassandra/db/ColumnFamilyStore.java  |  2 +-
 src/java/org/apache/cassandra/db/Keyspace.java  |  4 +-
 .../org/apache/cassandra/db/ReadCommand.java    |  2 +-
 .../io/sstable/format/SSTableReader.java        |  2 +-
 .../cassandra/schema/LegacySchemaMigrator.java  |  2 +-
 .../apache/cassandra/schema/SchemaKeyspace.java |  6 +--
 .../apache/cassandra/service/ClientState.java   | 44 +++++++++++---------
 .../apache/cassandra/service/StorageProxy.java  |  2 +-
 .../cassandra/service/StorageService.java       | 16 +++++--
 .../cassandra/thrift/ThriftValidation.java      |  2 +-
 .../cassandra/tools/nodetool/Cleanup.java       |  2 +-
 15 files changed, 67 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 9a8dd05,75f2c29..62525f1
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,6 -1,5 +1,7 @@@
 -3.0.16
 +3.11.2
 + * Avoid locks when checking LCS fanout and if we should defrag 
(CASSANDRA-13930)
 +Merged from 3.0:
+  * Don't let user drop or generally break tables in system_distributed 
(CASSANDRA-13813)
   * Provide a JMX call to sync schema with local storage (CASSANDRA-13954)
   * Mishandling of cells for removed/dropped columns when reading legacy files 
(CASSANDRA-13939)
   * Deserialise sstable metadata in nodetool verify (CASSANDRA-13922)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/config/Schema.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/Schema.java
index ec6974d,6d91d8d..8fc83df
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@@ -296,7 -344,7 +296,7 @@@ public class Schem
  
      private Set<String> getNonSystemKeyspacesSet()
      {
-         return Sets.difference(keyspaces.keySet(), 
SchemaConstants.SYSTEM_KEYSPACE_NAMES);
 -        return Sets.difference(keyspaces.keySet(), 
LOCAL_SYSTEM_KEYSPACE_NAMES);
++        return Sets.difference(keyspaces.keySet(), 
SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES);
      }
  
      /**
@@@ -334,7 -382,7 +334,7 @@@
  
          keyspaces.values()
                   .stream()
-                  .filter(k -> !SchemaConstants.isSystemKeyspace(k.name))
 -                 .filter(k -> !Schema.isLocalSystemKeyspace(k.name))
++                 .filter(k -> !SchemaConstants.isLocalSystemKeyspace(k.name))
                   .forEach(builder::add);
  
          return builder.build();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/config/SchemaConstants.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/SchemaConstants.java
index 2416d6b,0000000..9e60b60
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/config/SchemaConstants.java
+++ b/src/java/org/apache/cassandra/config/SchemaConstants.java
@@@ -1,74 -1,0 +1,82 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +package org.apache.cassandra.config;
 +
 +import java.security.MessageDigest;
 +import java.security.NoSuchAlgorithmException;
 +import java.util.Set;
 +import java.util.UUID;
 +
 +import com.google.common.collect.ImmutableSet;
 +
 +public final class SchemaConstants
 +{
 +    public static final String SYSTEM_KEYSPACE_NAME = "system";
 +    public static final String SCHEMA_KEYSPACE_NAME = "system_schema";
 +
 +    public static final String TRACE_KEYSPACE_NAME = "system_traces";
 +    public static final String AUTH_KEYSPACE_NAME = "system_auth";
 +    public static final String DISTRIBUTED_KEYSPACE_NAME = 
"system_distributed";
 +
 +    /* system keyspace names (the ones with LocalStrategy replication 
strategy) */
-     public static final Set<String> SYSTEM_KEYSPACE_NAMES = 
ImmutableSet.of(SYSTEM_KEYSPACE_NAME, SCHEMA_KEYSPACE_NAME);
++    public static final Set<String> LOCAL_SYSTEM_KEYSPACE_NAMES =
++        ImmutableSet.of(SYSTEM_KEYSPACE_NAME, SCHEMA_KEYSPACE_NAME);
 +
 +    /* replicate system keyspace names (the ones with a "true" replication 
strategy) */
-     public static final Set<String> REPLICATED_SYSTEM_KEYSPACE_NAMES = 
ImmutableSet.of(TRACE_KEYSPACE_NAME,
-                                                                               
         AUTH_KEYSPACE_NAME,
-                                                                               
         DISTRIBUTED_KEYSPACE_NAME);
++    public static final Set<String> REPLICATED_SYSTEM_KEYSPACE_NAMES =
++        ImmutableSet.of(TRACE_KEYSPACE_NAME, AUTH_KEYSPACE_NAME, 
DISTRIBUTED_KEYSPACE_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
 +     * ~64 characters, we could allow longer names than this, but on Windows, 
the entire path should be not greater than
 +     * 255 characters, so a lower limit here helps avoid problems.  See 
CASSANDRA-4110.
 +     */
 +    public static final int NAME_LENGTH = 48;
 +
 +    // 59adb24e-f3cd-3e02-97f0-5b395827453f
 +    public static final UUID emptyVersion;
 +
 +    static
 +    {
 +        try
 +        {
 +            emptyVersion = 
UUID.nameUUIDFromBytes(MessageDigest.getInstance("MD5").digest());
 +        }
 +        catch (NoSuchAlgorithmException e)
 +        {
 +            throw new AssertionError();
 +        }
 +    }
 +
 +    /**
 +     * @return whether or not the keyspace is a really system one (w/ 
LocalStrategy, unmodifiable, hardcoded)
 +     */
-     public static boolean isSystemKeyspace(String keyspaceName)
++    public static boolean isLocalSystemKeyspace(String keyspaceName)
 +    {
-         return SYSTEM_KEYSPACE_NAMES.contains(keyspaceName.toLowerCase());
++        return 
LOCAL_SYSTEM_KEYSPACE_NAMES.contains(keyspaceName.toLowerCase());
++    }
++
++    /**
++     * @return whether or not the keyspace is a replicated system ks 
(system_auth, system_traces, system_distributed)
++     */
++    public static boolean isReplicatedSystemKeyspace(String keyspaceName)
++    {
++        return 
REPLICATED_SYSTEM_KEYSPACE_NAMES.contains(keyspaceName.toLowerCase());
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/cql3/statements/AlterKeyspaceStatement.java
----------------------------------------------------------------------
diff --cc 
src/java/org/apache/cassandra/cql3/statements/AlterKeyspaceStatement.java
index f3df6f2,3ca4d72..76c8d2f
--- a/src/java/org/apache/cassandra/cql3/statements/AlterKeyspaceStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterKeyspaceStatement.java
@@@ -57,7 -56,7 +57,7 @@@ public class AlterKeyspaceStatement ext
          KeyspaceMetadata ksm = Schema.instance.getKSMetaData(name);
          if (ksm == null)
              throw new InvalidRequestException("Unknown keyspace " + name);
-         if (SchemaConstants.isSystemKeyspace(ksm.name))
 -        if (Schema.isLocalSystemKeyspace(ksm.name))
++        if (SchemaConstants.isLocalSystemKeyspace(ksm.name))
              throw new InvalidRequestException("Cannot alter system keyspace");
  
          attrs.validate();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 1b01c3f,536681f..c9514ca
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -1797,7 -1651,8 +1797,7 @@@ public class ColumnFamilyStore implemen
                  }
  
                  writeSnapshotManifest(filesJSONArr, snapshotName);
-                 if 
(!SchemaConstants.SYSTEM_KEYSPACE_NAMES.contains(metadata.ksName) && 
!SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES.contains(metadata.ksName))
 -
 -                if (!Schema.isLocalSystemKeyspace(metadata.ksName) && 
!Schema.isReplicatedSystemKeyspace(metadata.ksName))
++                if (!SchemaConstants.isLocalSystemKeyspace(metadata.ksName) 
&& !SchemaConstants.isReplicatedSystemKeyspace(metadata.ksName))
                      writeSnapshotSchema(snapshotName);
              }
          }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/db/Keyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Keyspace.java
index a550b1b,3d3e037..cffdb80
--- a/src/java/org/apache/cassandra/db/Keyspace.java
+++ b/src/java/org/apache/cassandra/db/Keyspace.java
@@@ -100,7 -102,7 +100,7 @@@ public class Keyspac
  
      public static Keyspace open(String keyspaceName)
      {
-         assert initialized || SchemaConstants.isSystemKeyspace(keyspaceName);
 -        assert initialized || Schema.isLocalSystemKeyspace(keyspaceName);
++        assert initialized || 
SchemaConstants.isLocalSystemKeyspace(keyspaceName);
          return open(keyspaceName, Schema.instance, true);
      }
  
@@@ -730,7 -681,7 +730,7 @@@
  
      public static Iterable<Keyspace> system()
      {
-         return Iterables.transform(SchemaConstants.SYSTEM_KEYSPACE_NAMES, 
keyspaceTransformer);
 -        return Iterables.transform(Schema.LOCAL_SYSTEM_KEYSPACE_NAMES, 
keyspaceTransformer);
++        return 
Iterables.transform(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES, 
keyspaceTransformer);
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/db/ReadCommand.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ReadCommand.java
index c733b21,c93692a..ab8779e
--- a/src/java/org/apache/cassandra/db/ReadCommand.java
+++ b/src/java/org/apache/cassandra/db/ReadCommand.java
@@@ -464,7 -451,7 +464,7 @@@ public abstract class ReadCommand exten
              private final int failureThreshold = 
DatabaseDescriptor.getTombstoneFailureThreshold();
              private final int warningThreshold = 
DatabaseDescriptor.getTombstoneWarnThreshold();
  
-             private final boolean respectTombstoneThresholds = 
!SchemaConstants.isSystemKeyspace(ReadCommand.this.metadata().ksName);
 -            private final boolean respectTombstoneThresholds = 
!Schema.isLocalSystemKeyspace(ReadCommand.this.metadata().ksName);
++            private final boolean respectTombstoneThresholds = 
!SchemaConstants.isLocalSystemKeyspace(ReadCommand.this.metadata().ksName);
              private final boolean enforceStrictLiveness = 
metadata.enforceStrictLiveness();
  
              private int liveRows = 0;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
index 5d76f75,fb9343f..8058a54
--- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
@@@ -2246,8 -2213,7 +2246,8 @@@ public abstract class SSTableReader ext
  
              // Don't track read rates for tables in the system keyspace and 
don't bother trying to load or persist
              // the read meter when in client mode.
 -            if (Schema.isLocalSystemKeyspace(desc.ksname) || 
!DatabaseDescriptor.isDaemonInitialized())
 +            // Also, do not track read rates when running in client or tools 
mode (syncExecuter isn't available in these modes)
-             if (SchemaConstants.isSystemKeyspace(desc.ksname) || 
DatabaseDescriptor.isClientOrToolInitialized())
++            if (SchemaConstants.isLocalSystemKeyspace(desc.ksname) || 
DatabaseDescriptor.isClientOrToolInitialized())
              {
                  readMeter = null;
                  readMeterSyncFuture = NULL;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
index 04d5f4e,184effc..fdbf176
--- a/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
+++ b/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
@@@ -169,10 -170,10 +169,10 @@@ public final class LegacySchemaMigrato
       */
      private static Collection<Keyspace> readSchema()
      {
 -        String query = format("SELECT keyspace_name FROM %s.%s", 
SystemKeyspace.NAME, SystemKeyspace.LEGACY_KEYSPACES);
 +        String query = format("SELECT keyspace_name FROM %s.%s", 
SchemaConstants.SYSTEM_KEYSPACE_NAME, SystemKeyspace.LEGACY_KEYSPACES);
          Collection<String> keyspaceNames = new ArrayList<>();
          query(query).forEach(row -> 
keyspaceNames.add(row.getString("keyspace_name")));
-         keyspaceNames.removeAll(SchemaConstants.SYSTEM_KEYSPACE_NAMES);
 -        keyspaceNames.removeAll(Schema.LOCAL_SYSTEM_KEYSPACE_NAMES);
++        keyspaceNames.removeAll(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES);
  
          Collection<Keyspace> keyspaces = new ArrayList<>();
          keyspaceNames.forEach(name -> keyspaces.add(readKeyspace(name)));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index 3cc2282,578f501..7834b12
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -287,8 -279,8 +287,8 @@@ public final class SchemaKeyspac
          // delete old, possibly obsolete entries in schema tables
          for (String schemaTable : ALL)
          {
 -            String query = String.format("DELETE FROM %s.%s USING TIMESTAMP ? 
WHERE keyspace_name = ?", NAME, schemaTable);
 -            for (String systemKeyspace : Schema.LOCAL_SYSTEM_KEYSPACE_NAMES)
 +            String query = String.format("DELETE FROM %s.%s USING TIMESTAMP ? 
WHERE keyspace_name = ?", SchemaConstants.SCHEMA_KEYSPACE_NAME, schemaTable);
-             for (String systemKeyspace : 
SchemaConstants.SYSTEM_KEYSPACE_NAMES)
++            for (String systemKeyspace : 
SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES)
                  executeOnceInternal(query, timestamp, systemKeyspace);
          }
  
@@@ -431,7 -402,7 +431,7 @@@
  
      private static boolean isSystemKeyspaceSchemaPartition(DecoratedKey 
partitionKey)
      {
-         return 
SchemaConstants.isSystemKeyspace(UTF8Type.instance.compose(partitionKey.getKey()));
 -        return 
Schema.isLocalSystemKeyspace(UTF8Type.instance.compose(partitionKey.getKey()));
++        return 
SchemaConstants.isLocalSystemKeyspace(UTF8Type.instance.compose(partitionKey.getKey()));
      }
  
      /*
@@@ -907,7 -880,7 +907,7 @@@
  
      public static Keyspaces fetchNonSystemKeyspaces()
      {
-         return fetchKeyspacesWithout(SchemaConstants.SYSTEM_KEYSPACE_NAMES);
 -        return fetchKeyspacesWithout(Schema.LOCAL_SYSTEM_KEYSPACE_NAMES);
++        return 
fetchKeyspacesWithout(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES);
      }
  
      private static Keyspaces fetchKeyspacesWithout(Set<String> 
excludedKeyspaceNames)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/service/ClientState.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/ClientState.java
index 5f01702,32849bc..2511779
--- a/src/java/org/apache/cassandra/service/ClientState.java
+++ b/src/java/org/apache/cassandra/service/ClientState.java
@@@ -74,14 -71,10 +73,9 @@@ public class ClientStat
              
PROTECTED_AUTH_RESOURCES.addAll(DatabaseDescriptor.getRoleManager().protectedResources());
          }
  
-         // allow users with sufficient privileges to alter KS level options 
on AUTH_KS and
-         // TRACING_KS, and also to drop legacy tables (users, credentials, 
permissions) from
-         // AUTH_KS
-         ALTERABLE_SYSTEM_KEYSPACES.add(SchemaConstants.AUTH_KEYSPACE_NAME);
-         ALTERABLE_SYSTEM_KEYSPACES.add(SchemaConstants.TRACE_KEYSPACE_NAME);
-         
DROPPABLE_SYSTEM_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 PasswordAuthenticator.LEGACY_CREDENTIALS_TABLE));
-         
DROPPABLE_SYSTEM_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 CassandraRoleManager.LEGACY_USERS_TABLE));
-         
DROPPABLE_SYSTEM_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 CassandraAuthorizer.USER_PERMISSIONS));
 -        // allow users with sufficient privileges to drop legacy tables 
(users, credentials, permissions) from AUTH_KS
 -        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(AuthKeyspace.NAME, 
PasswordAuthenticator.LEGACY_CREDENTIALS_TABLE));
 -        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(AuthKeyspace.NAME, 
CassandraRoleManager.LEGACY_USERS_TABLE));
 -        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(AuthKeyspace.NAME, 
CassandraAuthorizer.USER_PERMISSIONS));
++        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 PasswordAuthenticator.LEGACY_CREDENTIALS_TABLE));
++        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 CassandraRoleManager.LEGACY_USERS_TABLE));
++        
DROPPABLE_SYSTEM_AUTH_TABLES.add(DataResource.table(SchemaConstants.AUTH_KEYSPACE_NAME,
 CassandraAuthorizer.USER_PERMISSIONS));
      }
  
      // Current user for the session
@@@ -360,21 -353,25 +360,25 @@@
  
      private void preventSystemKSSchemaModification(String keyspace, 
DataResource resource, Permission perm) throws UnauthorizedException
      {
-         // we only care about schema modification.
-         if (!((perm == Permission.ALTER) || (perm == Permission.DROP) || 
(perm == Permission.CREATE)))
+         // we only care about DDL statements
+         if (perm != Permission.ALTER && perm != Permission.DROP && perm != 
Permission.CREATE)
              return;
  
-         // prevent system keyspace modification
-         if (SchemaConstants.isSystemKeyspace(keyspace))
+         // prevent ALL local system keyspace modification
 -        if (Schema.isLocalSystemKeyspace(keyspace))
++        if (SchemaConstants.isLocalSystemKeyspace(keyspace))
              throw new UnauthorizedException(keyspace + " keyspace is not 
user-modifiable.");
  
-         // allow users with sufficient privileges to alter KS level options 
on AUTH_KS and
-         // TRACING_KS, and also to drop legacy tables (users, credentials, 
permissions) from
-         // AUTH_KS
-         if 
(ALTERABLE_SYSTEM_KEYSPACES.contains(resource.getKeyspace().toLowerCase())
-            && ((perm == Permission.ALTER && !resource.isKeyspaceLevel())
-                || (perm == Permission.DROP && 
!DROPPABLE_SYSTEM_TABLES.contains(resource))))
 -        if (Schema.isReplicatedSystemKeyspace(keyspace))
++        if (SchemaConstants.isReplicatedSystemKeyspace(keyspace))
          {
+             // allow users with sufficient privileges to alter replication 
params of replicated system keyspaces
+             if (perm == Permission.ALTER && resource.isKeyspaceLevel())
+                 return;
+ 
+             // allow users with sufficient privileges to drop legacy tables 
in replicated system keyspaces
+             if (perm == Permission.DROP && 
DROPPABLE_SYSTEM_AUTH_TABLES.contains(resource))
+                 return;
+ 
+             // prevent all other modifications of replicated system keyspaces
              throw new UnauthorizedException(String.format("Cannot %s %s", 
perm, resource));
          }
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageProxy.java
index c57b691,e380a3f..e67d46e
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@@ -1552,7 -1476,7 +1552,7 @@@ public class StorageProxy implements St
      private static boolean systemKeyspaceQuery(List<? extends ReadCommand> 
cmds)
      {
          for (ReadCommand cmd : cmds)
-             if (!SchemaConstants.isSystemKeyspace(cmd.metadata().ksName))
 -            if (!Schema.isLocalSystemKeyspace(cmd.metadata().ksName))
++            if (!SchemaConstants.isLocalSystemKeyspace(cmd.metadata().ksName))
                  return false;
          return true;
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 2c17fb8,e5a50dd..5b4e552
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -2943,7 -2692,7 +2953,7 @@@ public class StorageService extends Not
  
      public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... 
tables) throws IOException, ExecutionException, InterruptedException
      {
-         if (SchemaConstants.isSystemKeyspace(keyspaceName))
 -        if (Schema.isLocalSystemKeyspace(keyspaceName))
++        if (SchemaConstants.isLocalSystemKeyspace(keyspaceName))
              throw new RuntimeException("Cleanup of the system keyspace is 
neither necessary nor wise");
  
          CompactionManager.AllSSTableOpStatus status = 
CompactionManager.AllSSTableOpStatus.SUCCESSFUL;
@@@ -3266,7 -2936,7 +3276,7 @@@
          Map<String, TabularData> snapshotMap = new HashMap<>();
          for (Keyspace keyspace : Keyspace.all())
          {
-             if (SchemaConstants.isSystemKeyspace(keyspace.getName()))
 -            if (Schema.isLocalSystemKeyspace(keyspace.getName()))
++            if (SchemaConstants.isLocalSystemKeyspace(keyspace.getName()))
                  continue;
  
              for (ColumnFamilyStore cfStore : keyspace.getColumnFamilyStores())
@@@ -3292,7 -2962,7 +3302,7 @@@
          long total = 0;
          for (Keyspace keyspace : Keyspace.all())
          {
-             if (SchemaConstants.isSystemKeyspace(keyspace.getName()))
 -            if (Schema.isLocalSystemKeyspace(keyspace.getName()))
++            if (SchemaConstants.isLocalSystemKeyspace(keyspace.getName()))
                  continue;
  
              for (ColumnFamilyStore cfStore : keyspace.getColumnFamilyStores())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/thrift/ThriftValidation.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/thrift/ThriftValidation.java
index 36a9755,99aed05..a3ee106
--- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
@@@ -636,7 -636,7 +636,7 @@@ public class ThriftValidatio
  
      public static void validateKeyspaceNotSystem(String modifiedKeyspace) 
throws org.apache.cassandra.exceptions.InvalidRequestException
      {
-         if (SchemaConstants.isSystemKeyspace(modifiedKeyspace))
 -        if (Schema.isLocalSystemKeyspace(modifiedKeyspace))
++        if (SchemaConstants.isLocalSystemKeyspace(modifiedKeyspace))
              throw new 
org.apache.cassandra.exceptions.InvalidRequestException(String.format("%s 
keyspace is not user-modifiable", modifiedKeyspace));
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f5e8d167/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
index c964b2f,47c65c8..3e6fa23
--- a/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
@@@ -47,7 -47,7 +47,7 @@@ public class Cleanup extends NodeToolCm
  
          for (String keyspace : keyspaces)
          {
-             if (SchemaConstants.isSystemKeyspace(keyspace))
 -            if (Schema.isLocalSystemKeyspace(keyspace))
++            if (SchemaConstants.isLocalSystemKeyspace(keyspace))
                  continue;
  
              try


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to