cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/2] cassandra git commit: Fix occasional lack of `system` keyspace in schema tables
Date Thu, 04 Jun 2015 15:31:58 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 96677ca12 -> 9befa3766


Fix occasional lack of `system` keyspace in schema tables

patch by Aleksey Yeschenko; reviewed by Sam Tunnicliffe for
CASSANDRA-8487


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

Branch: refs/heads/cassandra-2.2
Commit: f1b22dfc4042cebb2de0e17d296ac4d7bc7d53df
Parents: b3177f1
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Jun 4 01:56:13 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Jun 4 18:29:27 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 src/java/org/apache/cassandra/db/SystemKeyspace.java | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f1b22dfc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index eea1640..ac3fc53 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Fix occasional lack of `system` keyspace in schema tables (CASSANDRA-8487)
  * Use ProtocolError code instead of ServerError code for native protocol
    error responses to unsupported protocol versions (CASSANDRA-9451)
  * Default commitlog_sync_batch_window_in_ms changed to 2ms (CASSANDRA-9504)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f1b22dfc/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 882dbdf..7081abf 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -117,16 +117,22 @@ public class SystemKeyspace
         // add entries to system schema columnfamilies for the hardcoded system definitions
         KSMetaData ksmd = Schema.instance.getKSMetaData(Keyspace.SYSTEM_KS);
 
+        long timestamp = FBUtilities.timestampMicros();
+
         // delete old, possibly obsolete entries in schema columnfamilies
         for (String cfname : Arrays.asList(SystemKeyspace.SCHEMA_KEYSPACES_CF,
                                            SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF,
                                            SystemKeyspace.SCHEMA_COLUMNS_CF,
                                            SystemKeyspace.SCHEMA_TRIGGERS_CF,
                                            SystemKeyspace.SCHEMA_USER_TYPES_CF))
-            executeOnceInternal(String.format("DELETE FROM system.%s WHERE keyspace_name
= ?", cfname), ksmd.name);
+        {
+            executeOnceInternal(String.format("DELETE FROM system.%s USING TIMESTAMP ? WHERE
keyspace_name = ?", cfname),
+                                timestamp,
+                                ksmd.name);
+        }
 
         // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just
added)
-        ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
+        ksmd.toSchema(timestamp + 1).apply();
     }
 
     private static void setupVersion()


Mime
View raw message