This is an automated email from the ASF dual-hosted git repository.

bereng pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 7d0cb2015d76a82a9baf1c4769345ebb5194f212
Merge: 8e225c5 5aa2fb8
Author: Bereng <berenguerbl...@gmail.com>
AuthorDate: Tue Oct 26 07:44:20 2021 +0200

    Merge branch 'cassandra-4.0' into trunk

 .../org/apache/cassandra/db/SystemKeyspace.java    |   2 +-
 .../cassandra/io/sstable/CQLSSTableWriter.java     |   2 +-
 .../apache/cassandra/schema/MigrationManager.java  |   2 +-
 src/java/org/apache/cassandra/schema/Schema.java   |  41 ++++++++-
 .../apache/cassandra/schema/SchemaKeyspace.java    |  43 +++------
 .../cassandra/schema/SchemaKeyspaceTables.java     |  59 ++++++++++++
 .../cassandra/schema/SchemaPullVerbHandler.java    |   2 +-
 .../org/apache/cassandra/service/ClientState.java  |   4 +-
 .../cassandra/utils/NativeSSTableLoaderClient.java |  10 +-
 .../distributed/test/metric/TableMetricTest.java   |   2 +-
 .../cassandra/cql3/PstmtPersistenceTest.java       |   4 +-
 test/unit/org/apache/cassandra/cql3/ViewTest.java  |   4 +-
 .../cql3/validation/operations/AlterTest.java      |  16 ++--
 .../cql3/validation/operations/CreateTest.java     |  20 ++--
 .../operations/InsertUpdateIfConditionTest.java    |  12 +--
 .../org/apache/cassandra/db/DirectoriesTest.java   |   6 +-
 .../apache/cassandra/db/SystemKeyspaceTest.java    |   3 +-
 .../cassandra/schema/SchemaKeyspaceTest.java       | 102 +++++++++++++++++----
 .../service/StorageServiceServerTest.java          |   2 +-
 19 files changed, 242 insertions(+), 94 deletions(-)

diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index e8c22b1,b4a322f..6d5e331
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -58,8 -61,11 +61,11 @@@ import static org.apache.cassandra.sche
  
  /**
   * system_schema.* tables and methods for manipulating them.
+  * 
+  * Please notice this class is _not_ thread safe. It should be accessed 
through {@link org.apache.cassandra.schema.Schema}. See CASSANDRA-16856/16996
   */
+ @NotThreadSafe
 -final class SchemaKeyspace
 +public final class SchemaKeyspace
  {
      private SchemaKeyspace()
      {
@@@ -101,7 -80,7 +80,7 @@@
       * The tables to which we added the cdc column. This is used in {@link 
#makeUpdateForSchema} below to make sure we skip that
       * column is cdc is disabled as the columns breaks pre-cdc to post-cdc 
upgrades (typically, 3.0 -> 3.X).
       */
--    private static final Set<String> TABLES_WITH_CDC_ADDED = 
ImmutableSet.of(TABLES, VIEWS);
++    private static final Set<String> TABLES_WITH_CDC_ADDED = 
ImmutableSet.of(SchemaKeyspaceTables.TABLES, SchemaKeyspaceTables.VIEWS);
  
      private static final TableMetadata Keyspaces =
          parse(KEYSPACES,
diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspaceTables.java
index 0000000,b6e825d..c00a4f7
mode 000000,100644..100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspaceTables.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspaceTables.java
@@@ -1,0 -1,62 +1,59 @@@
+ /*
+  * 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.schema;
+ 
+ import com.google.common.collect.ImmutableList;
+ 
 -public final class SchemaKeyspaceTables
++public class SchemaKeyspaceTables
+ {
 -    public static final String INDEXES = "indexes";
 -    public static final String AGGREGATES = "aggregates";
 -    public static final String FUNCTIONS = "functions";
 -    public static final String TYPES = "types";
 -    public static final String VIEWS = "views";
 -    public static final String TRIGGERS = "triggers";
 -    public static final String DROPPED_COLUMNS = "dropped_columns";
 -    public static final String COLUMNS = "columns";
 -    public static final String TABLES = "tables";
+     public static final String KEYSPACES = "keyspaces";
 -
++    public static final String TABLES = "tables";
++    public static final String COLUMNS = "columns";
++    public static final String DROPPED_COLUMNS = "dropped_columns";
++    public static final String TRIGGERS = "triggers";
++    public static final String VIEWS = "views";
++    public static final String TYPES = "types";
++    public static final String FUNCTIONS = "functions";
++    public static final String AGGREGATES = "aggregates";
++    public static final String INDEXES = "indexes";
++ 
+     /**
+      * The order in this list matters.
+      *
+      * When flushing schema tables, we want to flush them in a way that 
mitigates the effects of an abrupt shutdown whilst
+      * the tables are being flushed. On startup, we load the schema from disk 
before replaying the CL, so we need to
+      * try to avoid problems like reading a table without columns or types, 
for example. So columns and types should be
+      * flushed before tables, which should be flushed before keyspaces.
+      *
+      * When truncating, the order should be reversed. For immutable lists 
this is an efficient operation that simply
+      * iterates in reverse order.
+      *
+      * See CASSANDRA-12213 for more details.
+      */
+     public static final ImmutableList<String> ALL = ImmutableList.of(COLUMNS,
+                                                                      
DROPPED_COLUMNS,
+                                                                      TRIGGERS,
+                                                                      TYPES,
+                                                                      
FUNCTIONS,
+                                                                      
AGGREGATES,
+                                                                      INDEXES,
+                                                                      TABLES,
+                                                                      VIEWS,
+                                                                      
KEYSPACES);
+ 
 -    private SchemaKeyspaceTables()
 -    {
 -    }
+ }
diff --cc src/java/org/apache/cassandra/schema/SchemaPullVerbHandler.java
index 863c68c,16ee968..73b85b5
--- a/src/java/org/apache/cassandra/schema/SchemaPullVerbHandler.java
+++ b/src/java/org/apache/cassandra/schema/SchemaPullVerbHandler.java
@@@ -41,7 -41,7 +41,7 @@@ public final class SchemaPullVerbHandle
      public void doVerb(Message<NoPayload> message)
      {
          logger.trace("Received schema pull request from {}", message.from());
-         Message<Collection<Mutation>> response = 
message.responseWith(SchemaKeyspace.convertSchemaToMutations());
+         Message<Collection<Mutation>> response = 
message.responseWith(Schema.instance.schemaKeyspaceAsMutations());
          MessagingService.instance().send(response, message.from());
      }
 -}
 +}
diff --cc 
test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
index feddab3,2741f94..ee8957d
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
@@@ -22,11 -22,6 +22,12 @@@ import java.util.UUID
  import org.junit.Test;
  
  import org.apache.cassandra.config.DatabaseDescriptor;
 +import org.apache.cassandra.dht.OrderPreservingPartitioner;
 +import org.apache.cassandra.locator.InetAddressAndPort;
 +import org.apache.cassandra.locator.TokenMetadata;
 +import org.apache.cassandra.config.DatabaseDescriptor;
 +import org.apache.cassandra.schema.SchemaConstants;
++import org.apache.cassandra.schema.SchemaKeyspaceTables;
  import org.apache.cassandra.cql3.CQLTester;
  import org.apache.cassandra.db.ColumnFamilyStore;
  import org.apache.cassandra.db.Keyspace;
@@@ -37,7 -31,7 +38,6 @@@ import org.apache.cassandra.exceptions.
  import org.apache.cassandra.locator.InetAddressAndPort;
  import org.apache.cassandra.locator.TokenMetadata;
  import org.apache.cassandra.schema.SchemaConstants;
- import org.apache.cassandra.schema.SchemaKeyspace;
 -import org.apache.cassandra.schema.SchemaKeyspaceTables;
  import org.apache.cassandra.service.StorageService;
  import org.apache.cassandra.utils.FBUtilities;
  

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

Reply via email to