You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/09/18 14:15:30 UTC

[1/2] git commit: Migrate pre-2.0 key/value/column aliases to system.schema_columns

Updated Branches:
  refs/heads/trunk 4ba8e3c55 -> 08eb9c8f5


Migrate pre-2.0 key/value/column aliases to system.schema_columns

patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for
CASSANRA-6009


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

Branch: refs/heads/trunk
Commit: e638acec945924d31c35fa6308b62ab6873bec6a
Parents: 88e3977
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 18 15:12:09 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 18 15:12:09 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../org/apache/cassandra/db/SystemKeyspace.java | 27 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e638acec/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 46e1b43..0142c53 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,8 @@
  * Fix paged ranges with multiple replicas (CASSANDRA-6004)
  * Fix potential AssertionError during tracing (CASSANDRA-6041)
  * Fix NPE in sstablesplit (CASSANDRA-6027)
+ * Migrate pre-2.0 key/value/column aliases to system.schema_columns
+   (CASSANDRA-6009)
 Merged from 1.2:
  * Tuning knobs for dealing with large blobs and many CFs (CASSANDRA-5982)
  * (Hadoop) Fix CQLRW for thrift tables (CASSANDRA-6002)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e638acec/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 3e608b3..0342dbb 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -97,6 +97,8 @@ public class SystemKeyspace
     {
         setupVersion();
 
+        copyAllAliasesToColumnsProper();
+
         // add entries to system schema columnfamilies for the hardcoded system definitions
         for (String ksname : Schema.systemKeyspaceNames)
         {
@@ -114,6 +116,31 @@ public class SystemKeyspace
         }
     }
 
+    // Starting with 2.0 (CASSANDRA-5125) we keep all the 'aliases' in system.schema_columns together with the regular columns,
+    // but only for the newly-created tables. This migration is for the pre-2.0 created tables.
+    private static void copyAllAliasesToColumnsProper()
+    {
+        for (UntypedResultSet.Row row : processInternal(String.format("SELECT * FROM system.%s", SCHEMA_COLUMNFAMILIES_CF)))
+        {
+            CFMetaData table = CFMetaData.fromSchema(row);
+            String query = String.format("SELECT writetime(type) "
+                                         + "FROM system.%s "
+                                         + "WHERE keyspace_name = '%s' AND columnfamily_name = '%s'",
+                                         SCHEMA_COLUMNFAMILIES_CF,
+                                         table.ksName,
+                                         table.cfName);
+            long timestamp = processInternal(query).one().getLong("writetime(type)");
+            try
+            {
+                table.toSchema(timestamp).apply();
+            }
+            catch (ConfigurationException e)
+            {
+                // shouldn't happen
+            }
+        }
+    }
+
     private static void setupVersion()
     {
         String req = "INSERT INTO system.%s (key, release_version, cql_version, thrift_version, native_protocol_version, data_center, rack, partitioner) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')";


[2/2] git commit: Merge branch 'cassandra-2.0' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-2.0' into trunk


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

Branch: refs/heads/trunk
Commit: 08eb9c8f57ea1cb2ab534f294241c3904e1a2711
Parents: 4ba8e3c e638ace
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 18 15:13:29 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 18 15:15:03 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/08eb9c8f/CHANGES.txt
----------------------------------------------------------------------