Updated Branches:
  refs/heads/cassandra-1.2 811f82c5b -> 4b2923a46

Don't provide oldCfId for post-1.1 system cfs

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5490


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

Branch: refs/heads/cassandra-1.2
Commit: 4b2923a460743b49a863def3392e4e0fb1697a1f
Parents: 811f82c
Author: Aleksey Yeschenko <alek...@apache.org>
Authored: Fri Apr 19 23:55:48 2013 +0300
Committer: Aleksey Yeschenko <alek...@apache.org>
Committed: Fri Apr 19 23:55:48 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/config/CFMetaData.java    |  164 ++++++++-------
 2 files changed, 89 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4b2923a4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7fc93f4..8c4cced 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@
  * Fix streaming RangeTombstones at column index boundary (CASSANDRA-5418)
  * Fix preparing statements when current keyspace is not set (CASSANDRA-5468)
  * Fix SemanticVersion.isSupportedBy minor/patch handling (CASSANDRA-5496)
+ * Don't provide oldCfId for post-1.1 system cfs (CASSANDRA-5490)
 Merged from 1.1
  * Add retry mechanism to OTC for non-droppable_verbs (CASSANDRA-5393)
  * Use allocator information to improve memtable memory usage estimate 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4b2923a4/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java 
b/src/java/org/apache/cassandra/config/CFMetaData.java
index 31720b2..a5fc5dd 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -109,6 +109,7 @@ public final class CFMetaData
                                                                   + 
"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,"
@@ -139,6 +140,7 @@ public final class CFMetaData
                                                                      + 
"default_write_consistency 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,"
@@ -151,80 +153,80 @@ public final class CFMetaData
                                                                + "PRIMARY 
KEY(keyspace_name, columnfamily_name, column_name)"
                                                                + ") WITH 
COMMENT='ColumnFamily column attributes' AND gc_grace_seconds=8640");
 
-    public static final CFMetaData HintsCf = compile(11, "CREATE TABLE " + 
SystemTable.HINTS_CF + " ("
-                                                         + "target_id uuid,"
-                                                         + "hint_id timeuuid,"
-                                                         + "message_version 
int,"
-                                                         + "mutation blob,"
-                                                         + "PRIMARY KEY 
(target_id, hint_id, message_version)"
-                                                         + ") WITH COMPACT 
STORAGE "
-                                                         + "AND 
COMPACTION={'class' : 'SizeTieredCompactionStrategy', 'min_threshold' : 0, 
'max_threshold' : 0} "
-                                                         + "AND COMMENT='hints 
awaiting delivery'"
-                                                         + "AND 
gc_grace_seconds=0");
-
-    public static final CFMetaData PeersCf = compile(12, "CREATE TABLE " + 
SystemTable.PEERS_CF + " ("
-                                                         + "peer inet PRIMARY 
KEY,"
-                                                         + "host_id uuid,"
-                                                         + "tokens 
set<varchar>,"
-                                                         + "schema_version 
uuid,"
-                                                         + "release_version 
text,"
-                                                         + "rpc_address inet,"
-                                                         + "data_center text,"
-                                                         + "rack text"
-                                                         + ") WITH 
COMMENT='known peers in the cluster'");
-
-    public static final CFMetaData PeerEventsCf = compile(12, "CREATE TABLE " 
+ SystemTable.PEER_EVENTS_CF + " ("
-                                                        + "peer inet PRIMARY 
KEY,"
-                                                        + "hints_dropped 
map<uuid, int>"
-                                                        + ") WITH COMMENT='cf 
contains events related to peers'");
-
-    public static final CFMetaData LocalCf = compile(13, "CREATE TABLE " + 
SystemTable.LOCAL_CF + " ("
-                                                         + "key text PRIMARY 
KEY,"
-                                                         + "tokens 
set<varchar>,"
-                                                         + "cluster_name text,"
-                                                         + "gossip_generation 
int,"
-                                                         + "bootstrapped text,"
-                                                         + "host_id uuid,"
-                                                         + "release_version 
text,"
-                                                         + "thrift_version 
text,"
-                                                         + "cql_version text,"
-                                                         + "data_center text,"
-                                                         + "rack text,"
-                                                         + "partitioner text,"
-                                                         + "schema_version 
uuid,"
-                                                         + "truncated_at 
map<uuid, blob>"
-                                                         + ") WITH 
COMMENT='information about the local node'");
-
-    public static final CFMetaData TraceSessionsCf = compile(14, "CREATE TABLE 
" + Tracing.SESSIONS_CF + " ("
-                                                               + "  session_id 
uuid PRIMARY KEY,"
-                                                               + "  
coordinator inet,"
-                                                               + "  request 
text,"
-                                                               + "  started_at 
timestamp,"
-                                                               + "  parameters 
map<text, text>,"
-                                                               + "  duration 
int"
-                                                               + ") WITH 
COMMENT='traced sessions'", Tracing.TRACE_KS);
-
-    public static final CFMetaData TraceEventsCf = compile(15, "CREATE TABLE " 
+ Tracing.EVENTS_CF + " ("
-                                                               + "  session_id 
uuid,"
-                                                               + "  event_id 
timeuuid,"
-                                                               + "  source 
inet,"
-                                                               + "  thread 
text,"
-                                                               + "  activity 
text,"
-                                                               + "  
source_elapsed int,"
-                                                               + "  PRIMARY 
KEY (session_id, event_id)"
-                                                               + ");", 
Tracing.TRACE_KS);
-
-    public static final CFMetaData BatchlogCf = compile(16, "CREATE TABLE " + 
SystemTable.BATCHLOG_CF + " ("
-                                                            + "id uuid PRIMARY 
KEY,"
-                                                            + "written_at 
timestamp,"
-                                                            + "data blob"
-                                                            + ") WITH 
COMMENT='uncommited batches' AND gc_grace_seconds=0 "
-                                                            + "AND 
COMPACTION={'class' : 'SizeTieredCompactionStrategy', 'min_threshold' : 2}");
-
-    public static final CFMetaData RangeXfersCf = compile(17, "CREATE TABLE " 
+ SystemTable.RANGE_XFERS_CF + " ("
-                                                              + "token_bytes 
blob PRIMARY KEY,"
-                                                              + "requested_at 
timestamp"
-                                                              + ") WITH 
COMMENT='ranges requested for transfer here'");
+    public static final CFMetaData HintsCf = compile("CREATE TABLE " + 
SystemTable.HINTS_CF + " ("
+                                                     + "target_id uuid,"
+                                                     + "hint_id timeuuid,"
+                                                     + "message_version int,"
+                                                     + "mutation blob,"
+                                                     + "PRIMARY KEY 
(target_id, hint_id, message_version)"
+                                                     + ") WITH COMPACT STORAGE 
"
+                                                     + "AND 
COMPACTION={'class' : 'SizeTieredCompactionStrategy', 'min_threshold' : 0, 
'max_threshold' : 0} "
+                                                     + "AND COMMENT='hints 
awaiting delivery'"
+                                                     + "AND 
gc_grace_seconds=0");
+
+    public static final CFMetaData PeersCf = compile("CREATE TABLE " + 
SystemTable.PEERS_CF + " ("
+                                                     + "peer inet PRIMARY KEY,"
+                                                     + "host_id uuid,"
+                                                     + "tokens set<varchar>,"
+                                                     + "schema_version uuid,"
+                                                     + "release_version text,"
+                                                     + "rpc_address inet,"
+                                                     + "data_center text,"
+                                                     + "rack text"
+                                                     + ") WITH COMMENT='known 
peers in the cluster'");
+
+    public static final CFMetaData PeerEventsCf = compile("CREATE TABLE " + 
SystemTable.PEER_EVENTS_CF + " ("
+                                                          + "peer inet PRIMARY 
KEY,"
+                                                          + "hints_dropped 
map<uuid, int>"
+                                                          + ") WITH 
COMMENT='cf contains events related to peers'");
+
+    public static final CFMetaData LocalCf = compile("CREATE TABLE " + 
SystemTable.LOCAL_CF + " ("
+                                                     + "key text PRIMARY KEY,"
+                                                     + "tokens set<varchar>,"
+                                                     + "cluster_name text,"
+                                                     + "gossip_generation int,"
+                                                     + "bootstrapped text,"
+                                                     + "host_id uuid,"
+                                                     + "release_version text,"
+                                                     + "thrift_version text,"
+                                                     + "cql_version text,"
+                                                     + "data_center text,"
+                                                     + "rack text,"
+                                                     + "partitioner text,"
+                                                     + "schema_version uuid,"
+                                                     + "truncated_at map<uuid, 
blob>"
+                                                     + ") WITH 
COMMENT='information about the local node'");
+
+    public static final CFMetaData TraceSessionsCf = compile("CREATE TABLE " + 
Tracing.SESSIONS_CF + " ("
+                                                             + "  session_id 
uuid PRIMARY KEY,"
+                                                             + "  coordinator 
inet,"
+                                                             + "  request 
text,"
+                                                             + "  started_at 
timestamp,"
+                                                             + "  parameters 
map<text, text>,"
+                                                             + "  duration int"
+                                                             + ") WITH 
COMMENT='traced sessions'", Tracing.TRACE_KS);
+
+    public static final CFMetaData TraceEventsCf = compile("CREATE TABLE " + 
Tracing.EVENTS_CF + " ("
+                                                           + "  session_id 
uuid,"
+                                                           + "  event_id 
timeuuid,"
+                                                           + "  source inet,"
+                                                           + "  thread text,"
+                                                           + "  activity text,"
+                                                           + "  source_elapsed 
int,"
+                                                           + "  PRIMARY KEY 
(session_id, event_id)"
+                                                           + ");", 
Tracing.TRACE_KS);
+
+    public static final CFMetaData BatchlogCf = compile("CREATE TABLE " + 
SystemTable.BATCHLOG_CF + " ("
+                                                        + "id uuid PRIMARY 
KEY,"
+                                                        + "written_at 
timestamp,"
+                                                        + "data blob"
+                                                        + ") WITH 
COMMENT='uncommited batches' AND gc_grace_seconds=0 "
+                                                        + "AND 
COMPACTION={'class' : 'SizeTieredCompactionStrategy', 'min_threshold' : 2}");
+
+    public static final CFMetaData RangeXfersCf = compile("CREATE TABLE " + 
SystemTable.RANGE_XFERS_CF + " ("
+                                                          + "token_bytes blob 
PRIMARY KEY,"
+                                                          + "requested_at 
timestamp"
+                                                          + ") WITH 
COMMENT='ranges requested for transfer here'");
 
     public enum Caching
     {
@@ -318,7 +320,12 @@ public final class CFMetaData
         updateCfDef(); // init cqlCfDef
     }
 
-    private static CFMetaData compile(int id, String cql, String keyspace)
+    private static CFMetaData compile(String cql, String keyspace)
+    {
+        return compile(null, cql, keyspace);
+    }
+
+    private static CFMetaData compile(Integer id, String cql, String keyspace)
     {
         try
         {
@@ -333,6 +340,11 @@ public final class CFMetaData
         }
     }
 
+    private static CFMetaData compile(String cql)
+    {
+        return compile(null, cql, Table.SYSTEM_KS);
+    }
+
     private static CFMetaData compile(int id, String cql)
     {
         return compile(id, cql, Table.SYSTEM_KS);
@@ -358,7 +370,7 @@ public final class CFMetaData
         updateCfDef(); // init cqlCfDef
     }
 
-    private static CFMetaData newSystemMetadata(String keyspace, String 
cfName, int oldCfId, String comment, AbstractType<?> comparator, 
AbstractType<?> subcc)
+    private static CFMetaData newSystemMetadata(String keyspace, String 
cfName, Integer oldCfId, String comment, AbstractType<?> comparator, 
AbstractType<?> subcc)
     {
         ColumnFamilyType type = subcc == null ? ColumnFamilyType.Standard : 
ColumnFamilyType.Super;
         CFMetaData newCFMD = new CFMetaData(keyspace, cfName, type, 
comparator,  subcc);

Reply via email to