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 2015/06/04 17:30:13 UTC

cassandra git commit: Fix occasional lack of `system` keyspace in schema tables

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 b3177f15a -> f1b22dfc4


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.1
Commit: f1b22dfc4042cebb2de0e17d296ac4d7bc7d53df
Parents: b3177f1
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Jun 4 01:56:13 2015 +0300
Committer: Aleksey Yeschenko <al...@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()