Merge branch 'cassandra-1.2' into cassandra-2.0.0

Conflicts:
        src/java/org/apache/cassandra/db/SystemKeyspace.java


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

Branch: refs/heads/trunk
Commit: 1716054231398f3804f6d08ab877cc09df190532
Parents: a347900 44925ac
Author: Aleksey Yeschenko <[email protected]>
Authored: Mon Aug 12 19:18:28 2013 +0200
Committer: Aleksey Yeschenko <[email protected]>
Committed: Mon Aug 12 19:18:28 2013 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/config/CFMetaData.java | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/17160542/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/CFMetaData.java
index 9d116f9,33e3f00..430d26d
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@@ -88,82 -79,79 +88,81 @@@ public final class CFMetaDat
      public final static boolean DEFAULT_POPULATE_IO_CACHE_ON_FLUSH = false;
  
      // Note that this is the default only for user created tables
 -    public final static String DEFAULT_COMPRESSOR = 
SnappyCompressor.isAvailable() ? SnappyCompressor.class.getCanonicalName() : 
null;
 -
 -    @Deprecated
 -    public static final CFMetaData OldStatusCf = 
newSystemMetadata(Table.SYSTEM_KS, SystemTable.OLD_STATUS_CF, 0, "unused", 
BytesType.instance, null);
 -    @Deprecated
 -    public static final CFMetaData OldHintsCf = 
newSystemMetadata(Table.SYSTEM_KS, SystemTable.OLD_HINTS_CF, 1, "unused", 
BytesType.instance, BytesType.instance);
 -    @Deprecated
 -    public static final CFMetaData OldMigrationsCf = 
newSystemMetadata(Table.SYSTEM_KS, DefsTable.OLD_MIGRATIONS_CF, 2, "unused", 
TimeUUIDType.instance, null);
 -    @Deprecated
 -    public static final CFMetaData OldSchemaCf = 
newSystemMetadata(Table.SYSTEM_KS, DefsTable.OLD_SCHEMA_CF, 3, "unused", 
UTF8Type.instance, null);
 -
 -    public static final CFMetaData IndexCf = compile(5, "CREATE TABLE \"" + 
SystemTable.INDEX_CF + "\" ("
 -                                                        + "table_name text,"
 -                                                        + "index_name text,"
 -                                                        + "PRIMARY KEY 
(table_name, index_name)"
 -                                                        + ") WITH COMPACT 
STORAGE AND COMMENT='indexes that have been completed'");
 -
 -    public static final CFMetaData CounterIdCf = compile(6, "CREATE TABLE \"" 
+ SystemTable.COUNTER_ID_CF + "\" ("
 -                                                            + "key text,"
 -                                                            + "id timeuuid,"
 -                                                            + "PRIMARY KEY 
(key, id)"
 -                                                            + ") WITH COMPACT 
STORAGE AND COMMENT='counter node IDs'");
 -
 -    // new-style schema
 -    public static final CFMetaData SchemaKeyspacesCf = compile(8, "CREATE 
TABLE " + SystemTable.SCHEMA_KEYSPACES_CF + "("
 -                                                                  + 
"keyspace_name text PRIMARY KEY,"
 -                                                                  + 
"durable_writes boolean,"
 -                                                                  + 
"strategy_class text,"
 -                                                                  + 
"strategy_options text"
 -                                                                  + ") WITH 
COMPACT STORAGE AND COMMENT='keyspace definitions' AND gc_grace_seconds=8640");
 -
 -    public static final CFMetaData SchemaColumnFamiliesCf = compile(9, 
"CREATE TABLE " + SystemTable.SCHEMA_COLUMNFAMILIES_CF + "("
 -                                                                       + 
"keyspace_name text,"
 -                                                                       + 
"columnfamily_name text,"
 -                                                                       + "id 
int,"
 -                                                                       + 
"type text,"
 -                                                                       + 
"comparator text,"
 -                                                                       + 
"subcomparator text,"
 -                                                                       + 
"comment text,"
 -                                                                       + 
"read_repair_chance double,"
 -                                                                       + 
"local_read_repair_chance double,"
 -                                                                       + 
"replicate_on_write boolean,"
 -                                                                       + 
"gc_grace_seconds int,"
 -                                                                       + 
"default_validator text,"
 -                                                                       + 
"key_validator text,"
 -                                                                       + 
"min_compaction_threshold int,"
 -                                                                       + 
"max_compaction_threshold int,"
 -                                                                       + 
"key_alias text," // that one is kept for compatibility sake
 -                                                                       + 
"key_aliases text,"
 -                                                                       + 
"bloom_filter_fp_chance double,"
 -                                                                       + 
"caching text,"
 -                                                                       + 
"populate_io_cache_on_flush boolean,"
 -                                                                       + 
"compaction_strategy_class text,"
 -                                                                       + 
"compression_parameters text,"
 -                                                                       + 
"value_alias text,"
 -                                                                       + 
"column_aliases text,"
 -                                                                       + 
"compaction_strategy_options text,"
 -                                                                       + 
"PRIMARY KEY (keyspace_name, columnfamily_name)"
 -                                                                       + ") 
WITH COMMENT='ColumnFamily definitions' AND gc_grace_seconds=8640");
 -
 -    public static final CFMetaData SchemaColumnsCf = compile(10, "CREATE 
TABLE " + SystemTable.SCHEMA_COLUMNS_CF + "("
 -                                                                 + 
"keyspace_name text,"
 -                                                                 + 
"columnfamily_name text,"
 -                                                                 + 
"column_name text,"
 -                                                                 + "validator 
text,"
 -                                                                 + 
"index_type text,"
 -                                                                 + 
"index_options text,"
 -                                                                 + 
"index_name text,"
 -                                                                 + 
"component_index int,"
 -                                                                 + "PRIMARY 
KEY(keyspace_name, columnfamily_name, column_name)"
 -                                                                 + ") WITH 
COMMENT='ColumnFamily column attributes' AND gc_grace_seconds=8640");
 -
 -    public static final CFMetaData HintsCf = compile("CREATE TABLE " + 
SystemTable.HINTS_CF + " ("
 +    public final static String DEFAULT_COMPRESSOR = 
LZ4Compressor.class.getCanonicalName();
 +
 +    public static final CFMetaData IndexCf = compile("CREATE TABLE \"" + 
SystemKeyspace.INDEX_CF + "\" ("
 +                                                     + "table_name text,"
 +                                                     + "index_name text,"
 +                                                     + "PRIMARY KEY 
(table_name, index_name)"
 +                                                     + ") WITH COMPACT 
STORAGE AND COMMENT='indexes that have been completed'");
 +
 +    public static final CFMetaData CounterIdCf = compile("CREATE TABLE \"" + 
SystemKeyspace.COUNTER_ID_CF + "\" ("
 +                                                         + "key text,"
 +                                                         + "id timeuuid,"
 +                                                         + "PRIMARY KEY (key, 
id)"
 +                                                         + ") WITH COMPACT 
STORAGE AND COMMENT='counter node IDs'");
 +
 +    public static final CFMetaData SchemaKeyspacesCf = compile("CREATE TABLE 
" + SystemKeyspace.SCHEMA_KEYSPACES_CF + " ("
 +                                                               + 
"keyspace_name text PRIMARY KEY,"
 +                                                               + 
"durable_writes boolean,"
 +                                                               + 
"strategy_class text,"
 +                                                               + 
"strategy_options text"
 +                                                               + ") WITH 
COMPACT STORAGE AND COMMENT='keyspace definitions' AND gc_grace_seconds=8640");
 +
 +    public static final CFMetaData SchemaColumnFamiliesCf = compile("CREATE 
TABLE " + SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF + " ("
 +                                                                    + 
"keyspace_name text,"
 +                                                                    + 
"columnfamily_name text,"
 +                                                                    + "type 
text,"
 +                                                                    + 
"comparator text,"
 +                                                                    + 
"subcomparator text,"
 +                                                                    + 
"comment text,"
 +                                                                    + 
"read_repair_chance double,"
 +                                                                    + 
"local_read_repair_chance double,"
 +                                                                    + 
"replicate_on_write boolean,"
 +                                                                    + 
"gc_grace_seconds int,"
 +                                                                    + 
"default_validator text,"
 +                                                                    + 
"key_validator text,"
 +                                                                    + 
"min_compaction_threshold int,"
 +                                                                    + 
"max_compaction_threshold int,"
 +                                                                    + 
"memtable_flush_period_in_ms int,"
-                                                                     + 
"key_alias text," // that one is kept for compatibility sake
 +                                                                    + 
"key_aliases text,"
 +                                                                    + 
"bloom_filter_fp_chance double,"
 +                                                                    + 
"caching text,"
 +                                                                    + 
"default_time_to_live int,"
 +                                                                    + 
"compaction_strategy_class text,"
 +                                                                    + 
"compression_parameters text,"
 +                                                                    + 
"value_alias text,"
 +                                                                    + 
"column_aliases text,"
 +                                                                    + 
"compaction_strategy_options text,"
 +                                                                    + 
"speculative_retry text,"
 +                                                                    + 
"populate_io_cache_on_flush boolean,"
 +                                                                    + 
"index_interval int,"
 +                                                                    + 
"dropped_columns map<text, bigint>,"
 +                                                                    + 
"PRIMARY KEY (keyspace_name, columnfamily_name)"
 +                                                                    + ") WITH 
COMMENT='ColumnFamily definitions' AND gc_grace_seconds=8640");
 +
 +    public static final CFMetaData SchemaColumnsCf = compile("CREATE TABLE " 
+ SystemKeyspace.SCHEMA_COLUMNS_CF + " ("
 +                                                             + "keyspace_name 
text,"
 +                                                             + 
"columnfamily_name text,"
 +                                                             + "column_name 
text,"
 +                                                             + "validator 
text,"
 +                                                             + "index_type 
text,"
 +                                                             + "index_options 
text,"
 +                                                             + "index_name 
text,"
 +                                                             + 
"component_index int,"
 +                                                             + "type text,"
 +                                                             + "PRIMARY 
KEY(keyspace_name, columnfamily_name, column_name)"
 +                                                             + ") WITH 
COMMENT='ColumnFamily column attributes' AND gc_grace_seconds=8640");
 +
 +    public static final CFMetaData SchemaTriggersCf = compile("CREATE TABLE " 
+ SystemKeyspace.SCHEMA_TRIGGERS_CF + " ("
 +                                                              + 
"keyspace_name text,"
 +                                                              + 
"columnfamily_name text,"
 +                                                              + "trigger_name 
text,"
 +                                                              + 
"trigger_options map<text, text>,"
 +                                                              + "PRIMARY KEY 
(keyspace_name, columnfamily_name, trigger_name)"
 +                                                              + ") WITH 
COMMENT='triggers metadata table'");
 +
 +    public static final CFMetaData HintsCf = compile("CREATE TABLE " + 
SystemKeyspace.HINTS_CF + " ("
                                                       + "target_id uuid,"
                                                       + "hint_id timeuuid,"
                                                       + "message_version int,"
@@@ -1561,59 -1395,30 +1560,54 @@@
              
cfm.maxCompactionThreshold(result.getInt("max_compaction_threshold"));
              if (result.has("comment"))
                  cfm.comment(result.getString("comment"));
--            // We need support the old key_alias for compatibility sake
 -            if (result.has("key_aliases"))
 -            {
 -                
cfm.keyAliases(aliasesFromStrings(fromJsonList(result.getString("key_aliases"))));
 -            }
 -            else if (result.has("key_alias"))
 -            {
 -                
cfm.keyAliases(Collections.<ByteBuffer>singletonList(result.getBytes("key_alias")));
 -            }
              if (result.has("bloom_filter_fp_chance"))
                  
cfm.bloomFilterFpChance(result.getDouble("bloom_filter_fp_chance"));
 +            if (result.has("memtable_flush_period_in_ms"))
 +                
cfm.memtableFlushPeriod(result.getInt("memtable_flush_period_in_ms"));
              cfm.caching(Caching.valueOf(result.getString("caching")));
 +            if (result.has("default_time_to_live"))
 +                cfm.defaultTimeToLive(result.getInt("default_time_to_live"));
 +            if (result.has("speculative_retry"))
 +                
cfm.speculativeRetry(SpeculativeRetry.fromString(result.getString("speculative_retry")));
              
cfm.compactionStrategyClass(createCompactionStrategy(result.getString("compaction_strategy_class")));
              
cfm.compressionParameters(CompressionParameters.create(fromJsonMap(result.getString("compression_parameters"))));
 -            
cfm.columnAliases(aliasesFromStrings(fromJsonList(result.getString("column_aliases"))));
 -            if (result.has("value_alias"))
 -                cfm.valueAlias(result.getBytes("value_alias"));
              
cfm.compactionStrategyOptions(fromJsonMap(result.getString("compaction_strategy_options")));
 +            if (result.has("index_interval"))
 +            {
 +                cfm.indexInterval(result.getInt("index_interval"));
 +            }
 +            else
 +            {
 +                if (DatabaseDescriptor.getIndexInterval() != null)
 +                {
 +                    // use index_interval set in cassandra.yaml as default 
value (in memory only)
 +                    cfm.indexInterval(DatabaseDescriptor.getIndexInterval());
 +                }
 +            }
              if (result.has("populate_io_cache_on_flush"))
                  
cfm.populateIoCacheOnFlush(result.getBoolean("populate_io_cache_on_flush"));
  
 +            /*
-              * The info previously hold by key_alias(es), column_alias and 
value_alias is now stored in column_metadata (because 1) this
++             * The info previously hold by key_aliases, column_aliases and 
value_alias is now stored in column_metadata (because 1) this
 +             * make more sense and 2) this allow to store indexing 
information).
 +             * However, for upgrade sake we need to still be able to read 
those old values. Moreover, we cannot easily
 +             * remove those old columns once "converted" to column_metadata 
because that would screw up nodes that may
 +             * not have upgraded. So for now we keep the both info and in 
sync, even though its redundant.
 +             * In other words, the ColumnDefinition the following lines add 
may be replaced later when ColumnDefinition.fromSchema
 +             * is called but that's ok.
 +             */
-             if (result.has("key_aliases"))
-                 
cfm.addColumnMetadataFromAliases(aliasesFromStrings(fromJsonList(result.getString("key_aliases"))),
 cfm.keyValidator, ColumnDefinition.Type.PARTITION_KEY);
-             else if (result.has("key_alias"))
-                 
cfm.addColumnMetadataFromAliases(Collections.<ByteBuffer>singletonList(result.getBytes("key_alias")),
 cfm.keyValidator, ColumnDefinition.Type.PARTITION_KEY);
- 
++            
cfm.addColumnMetadataFromAliases(aliasesFromStrings(fromJsonList(result.getString("key_aliases"))),
 cfm.keyValidator, ColumnDefinition.Type.PARTITION_KEY);
 +            
cfm.addColumnMetadataFromAliases(aliasesFromStrings(fromJsonList(result.getString("column_aliases"))),
 cfm.comparator, ColumnDefinition.Type.CLUSTERING_KEY);
 +
 +            if (result.has("value_alias"))
 +                
cfm.addColumnMetadataFromAliases(Collections.<ByteBuffer>singletonList(result.getBytes("value_alias")),
 cfm.defaultValidator, ColumnDefinition.Type.COMPACT_VALUE);
 +
 +            if (result.has("dropped_columns"))
 +                
cfm.droppedColumns(convertDroppedColumns(result.getMap("dropped_columns", 
UTF8Type.instance, LongType.instance)));
 +
              return cfm;
          }
 -        catch (SyntaxException e)
 +        catch (SyntaxException | ConfigurationException e)
          {
              throw new RuntimeException(e);
          }

Reply via email to