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

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

commit 26a134a552133be0b5130120cce99d83b0b3dcde
Merge: 8a04204 670dde9
Author: Aleksey Yeshchenko <alek...@apache.org>
AuthorDate: Tue Jul 16 18:49:49 2019 +0100

    Merge branch 'cassandra-3.11' into trunk

 CHANGES.txt                                              | 1 +
 src/java/org/apache/cassandra/schema/SchemaKeyspace.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --cc src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index d2abc03,285c843..3c3e063
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@@ -105,170 -104,171 +105,170 @@@ public final class SchemaKeyspac
       */
      private static final Set<String> TABLES_WITH_CDC_ADDED = 
ImmutableSet.of(TABLES, VIEWS);
  
 -
 -    /**
 -     * Until we upgrade the messaging service version, that is version 4.0, 
we must preserve the old order (before CASSANDRA-12213)
 -     * for digest calculations, otherwise the nodes will never agree on the 
schema during a rolling upgrade, see CASSANDRA-13559.
 -     */
 -    public static final ImmutableList<String> ALL_FOR_DIGEST =
 -        ImmutableList.of(KEYSPACES, TABLES, COLUMNS, TRIGGERS, VIEWS, TYPES, 
FUNCTIONS, AGGREGATES, INDEXES);
 -
 -    private static final CFMetaData Keyspaces =
 -        compile(KEYSPACES,
 -                "keyspace definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "durable_writes boolean,"
 -                + "replication frozen<map<text, text>>,"
 -                + "PRIMARY KEY ((keyspace_name)))");
 -
 -    private static final CFMetaData Tables =
 -        compile(TABLES,
 -                "table definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "table_name text,"
 -                + "bloom_filter_fp_chance double,"
 -                + "caching frozen<map<text, text>>,"
 -                + "comment text,"
 -                + "compaction frozen<map<text, text>>,"
 -                + "compression frozen<map<text, text>>,"
 -                + "crc_check_chance double,"
 -                + "dclocal_read_repair_chance double,"
 -                + "default_time_to_live int,"
 -                + "extensions frozen<map<text, blob>>,"
 -                + "flags frozen<set<text>>," // SUPER, COUNTER, DENSE, 
COMPOUND
 -                + "gc_grace_seconds int,"
 -                + "id uuid,"
 -                + "max_index_interval int,"
 -                + "memtable_flush_period_in_ms int,"
 -                + "min_index_interval int,"
 -                + "read_repair_chance double,"
 -                + "speculative_retry text,"
 -                + "cdc boolean,"
 -                + "PRIMARY KEY ((keyspace_name), table_name))");
 -
 -    private static final CFMetaData Columns =
 -        compile(COLUMNS,
 -                "column definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "table_name text,"
 -                + "column_name text,"
 -                + "clustering_order text,"
 -                + "column_name_bytes blob,"
 -                + "kind text,"
 -                + "position int,"
 -                + "type text,"
 -                + "PRIMARY KEY ((keyspace_name), table_name, column_name))");
 -
 -    private static final CFMetaData DroppedColumns =
 -        compile(DROPPED_COLUMNS,
 -                "dropped column registry",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "table_name text,"
 -                + "column_name text,"
 -                + "dropped_time timestamp,"
 -                + "kind text,"
 -                + "type text,"
 -                + "PRIMARY KEY ((keyspace_name), table_name, column_name))");
 -
 -    private static final CFMetaData Triggers =
 -        compile(TRIGGERS,
 -                "trigger definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "table_name text,"
 -                + "trigger_name text,"
 -                + "options frozen<map<text, text>>,"
 -                + "PRIMARY KEY ((keyspace_name), table_name, trigger_name))");
 -
 -    private static final CFMetaData Views =
 -        compile(VIEWS,
 -                "view definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "view_name text,"
 -                + "base_table_id uuid,"
 -                + "base_table_name text,"
 -                + "where_clause text,"
 -                + "bloom_filter_fp_chance double,"
 -                + "caching frozen<map<text, text>>,"
 -                + "comment text,"
 -                + "compaction frozen<map<text, text>>,"
 -                + "compression frozen<map<text, text>>,"
 -                + "crc_check_chance double,"
 -                + "dclocal_read_repair_chance double,"
 -                + "default_time_to_live int,"
 -                + "extensions frozen<map<text, blob>>,"
 -                + "gc_grace_seconds int,"
 -                + "id uuid,"
 -                + "include_all_columns boolean,"
 -                + "max_index_interval int,"
 -                + "memtable_flush_period_in_ms int,"
 -                + "min_index_interval int,"
 -                + "read_repair_chance double,"
 -                + "speculative_retry text,"
 -                + "cdc boolean,"
 -                + "PRIMARY KEY ((keyspace_name), view_name))");
 -
 -    private static final CFMetaData Indexes =
 -        compile(INDEXES,
 -                "secondary index definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "table_name text,"
 -                + "index_name text,"
 -                + "kind text,"
 -                + "options frozen<map<text, text>>,"
 -                + "PRIMARY KEY ((keyspace_name), table_name, index_name))");
 -
 -    private static final CFMetaData Types =
 -        compile(TYPES,
 -                "user defined type definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "type_name text,"
 -                + "field_names frozen<list<text>>,"
 -                + "field_types frozen<list<text>>,"
 -                + "PRIMARY KEY ((keyspace_name), type_name))");
 -
 -    private static final CFMetaData Functions =
 -        compile(FUNCTIONS,
 -                "user defined function definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "function_name text,"
 -                + "argument_types frozen<list<text>>,"
 -                + "argument_names frozen<list<text>>,"
 -                + "body text,"
 -                + "language text,"
 -                + "return_type text,"
 -                + "called_on_null_input boolean,"
 -                + "PRIMARY KEY ((keyspace_name), function_name, 
argument_types))");
 -
 -    private static final CFMetaData Aggregates =
 -        compile(AGGREGATES,
 -                "user defined aggregate definitions",
 -                "CREATE TABLE %s ("
 -                + "keyspace_name text,"
 -                + "aggregate_name text,"
 -                + "argument_types frozen<list<text>>,"
 -                + "final_func text,"
 -                + "initcond text,"
 -                + "return_type text,"
 -                + "state_func text,"
 -                + "state_type text,"
 -                + "PRIMARY KEY ((keyspace_name), aggregate_name, 
argument_types))");
 -
 -    public static final List<CFMetaData> ALL_TABLE_METADATA =
 +    private static final TableMetadata Keyspaces =
 +        parse(KEYSPACES,
 +              "keyspace definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "durable_writes boolean,"
 +              + "replication frozen<map<text, text>>,"
 +              + "PRIMARY KEY ((keyspace_name)))");
 +
 +    private static final TableMetadata Tables =
 +        parse(TABLES,
 +              "table definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "table_name text,"
 +              + "bloom_filter_fp_chance double,"
 +              + "caching frozen<map<text, text>>,"
 +              + "comment text,"
 +              + "compaction frozen<map<text, text>>,"
 +              + "compression frozen<map<text, text>>,"
 +              + "crc_check_chance double,"
 +              + "dclocal_read_repair_chance double," // no longer used, left 
for drivers' sake
 +              + "default_time_to_live int,"
 +              + "extensions frozen<map<text, blob>>,"
 +              + "flags frozen<set<text>>," // SUPER, COUNTER, DENSE, COMPOUND
 +              + "gc_grace_seconds int,"
 +              + "id uuid,"
 +              + "max_index_interval int,"
 +              + "memtable_flush_period_in_ms int,"
 +              + "min_index_interval int,"
 +              + "read_repair_chance double," // no longer used, left for 
drivers' sake
 +              + "speculative_retry text,"
 +              + "additional_write_policy text,"
 +              + "cdc boolean,"
 +              + "read_repair text,"
 +              + "PRIMARY KEY ((keyspace_name), table_name))");
 +
 +    private static final TableMetadata Columns =
 +        parse(COLUMNS,
 +              "column definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "table_name text,"
 +              + "column_name text,"
 +              + "clustering_order text,"
 +              + "column_name_bytes blob,"
 +              + "kind text,"
 +              + "position int,"
 +              + "type text,"
 +              + "PRIMARY KEY ((keyspace_name), table_name, column_name))");
 +
 +    private static final TableMetadata DroppedColumns =
 +        parse(DROPPED_COLUMNS,
 +              "dropped column registry",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "table_name text,"
 +              + "column_name text,"
 +              + "dropped_time timestamp,"
-               + "type text,"
 +              + "kind text,"
++              + "type text,"
 +              + "PRIMARY KEY ((keyspace_name), table_name, column_name))");
 +
 +    private static final TableMetadata Triggers =
 +        parse(TRIGGERS,
 +              "trigger definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "table_name text,"
 +              + "trigger_name text,"
 +              + "options frozen<map<text, text>>,"
 +              + "PRIMARY KEY ((keyspace_name), table_name, trigger_name))");
 +
 +    private static final TableMetadata Views =
 +        parse(VIEWS,
 +              "view definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "view_name text,"
 +              + "base_table_id uuid,"
 +              + "base_table_name text,"
 +              + "where_clause text,"
 +              + "bloom_filter_fp_chance double,"
 +              + "caching frozen<map<text, text>>,"
 +              + "comment text,"
 +              + "compaction frozen<map<text, text>>,"
 +              + "compression frozen<map<text, text>>,"
 +              + "crc_check_chance double,"
 +              + "dclocal_read_repair_chance double," // no longer used, left 
for drivers' sake
 +              + "default_time_to_live int,"
 +              + "extensions frozen<map<text, blob>>,"
 +              + "gc_grace_seconds int,"
 +              + "id uuid,"
 +              + "include_all_columns boolean,"
 +              + "max_index_interval int,"
 +              + "memtable_flush_period_in_ms int,"
 +              + "min_index_interval int,"
 +              + "read_repair_chance double," // no longer used, left for 
drivers' sake
 +              + "speculative_retry text,"
 +              + "additional_write_policy text,"
 +              + "cdc boolean,"
 +              + "read_repair text,"
 +              + "PRIMARY KEY ((keyspace_name), view_name))");
 +
 +    private static final TableMetadata Indexes =
 +        parse(INDEXES,
 +              "secondary index definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "table_name text,"
 +              + "index_name text,"
 +              + "kind text,"
 +              + "options frozen<map<text, text>>,"
 +              + "PRIMARY KEY ((keyspace_name), table_name, index_name))");
 +
 +    private static final TableMetadata Types =
 +        parse(TYPES,
 +              "user defined type definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "type_name text,"
 +              + "field_names frozen<list<text>>,"
 +              + "field_types frozen<list<text>>,"
 +              + "PRIMARY KEY ((keyspace_name), type_name))");
 +
 +    private static final TableMetadata Functions =
 +        parse(FUNCTIONS,
 +              "user defined function definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "function_name text,"
 +              + "argument_types frozen<list<text>>,"
 +              + "argument_names frozen<list<text>>,"
 +              + "body text,"
 +              + "language text,"
 +              + "return_type text,"
 +              + "called_on_null_input boolean,"
 +              + "PRIMARY KEY ((keyspace_name), function_name, 
argument_types))");
 +
 +    private static final TableMetadata Aggregates =
 +        parse(AGGREGATES,
 +              "user defined aggregate definitions",
 +              "CREATE TABLE %s ("
 +              + "keyspace_name text,"
 +              + "aggregate_name text,"
 +              + "argument_types frozen<list<text>>,"
 +              + "final_func text,"
 +              + "initcond text,"
 +              + "return_type text,"
 +              + "state_func text,"
 +              + "state_type text,"
 +              + "PRIMARY KEY ((keyspace_name), aggregate_name, 
argument_types))");
 +
 +    private static final List<TableMetadata> ALL_TABLE_METADATA =
          ImmutableList.of(Keyspaces, Tables, Columns, Triggers, 
DroppedColumns, Views, Types, Functions, Aggregates, Indexes);
  
 -    private static CFMetaData compile(String name, String description, String 
schema)
 +    private static TableMetadata parse(String name, String description, 
String cql)
      {
 -        return CFMetaData.compile(String.format(schema, name), 
SchemaConstants.SCHEMA_KEYSPACE_NAME)
 -                         .comment(description)
 -                         .gcGraceSeconds((int) TimeUnit.DAYS.toSeconds(7));
 +        return CreateTableStatement.parse(format(cql, name), 
SchemaConstants.SCHEMA_KEYSPACE_NAME)
 +                                   
.id(TableId.forSystemTable(SchemaConstants.SCHEMA_KEYSPACE_NAME, name))
 +                                   .gcGraceSeconds((int) 
TimeUnit.DAYS.toSeconds(7))
 +                                   .memtableFlushPeriod((int) 
TimeUnit.HOURS.toMillis(1))
 +                                   .comment(description)
 +                                   .build();
      }
  
      public static KeyspaceMetadata metadata()


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

Reply via email to