cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Add schema_version to local table (since local node is not in peers)
Date Wed, 14 Nov 2012 11:01:56 GMT
Updated Branches:
  refs/heads/cassandra-1.2.0 90de8d554 -> c4cca2d8b


Add schema_version to local table (since local node is not in peers)


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

Branch: refs/heads/cassandra-1.2.0
Commit: c4cca2d8bba20a7651b956e1893727391bf5f10a
Parents: 90de8d5
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Nov 14 12:01:48 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Nov 14 12:01:48 2012 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/config/CFMetaData.java    |    1 +
 src/java/org/apache/cassandra/config/Schema.java   |    1 +
 src/java/org/apache/cassandra/db/SystemTable.java  |    7 +++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4cca2d8/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 b50abc5..cb760f1 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -183,6 +183,7 @@ public final class CFMetaData
                                                          + "data_center text,"
                                                          + "rack text,"
                                                          + "partitioner text,"
+                                                         + "schema_version uuid,"
                                                          + "truncated_at map<uuid, blob>"
                                                          + ") WITH COMMENT='information about
the local node'");
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4cca2d8/src/java/org/apache/cassandra/config/Schema.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Schema.java b/src/java/org/apache/cassandra/config/Schema.java
index c3e90be..2f24d39 100644
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@ -440,6 +440,7 @@ public class Schema
             }
 
             version = UUID.nameUUIDFromBytes(versionDigest.digest());
+            SystemTable.updateSchemaVersion(version);
         }
         catch (Exception e)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4cca2d8/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java
index 5ec4bd4..7737887 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -258,6 +258,7 @@ public class SystemTable
         processInternal(String.format(req, PEERS_CF, ep.getHostAddress(), tokensAsSet(tokens)));
         forceBlockingFlush(PEERS_CF);
     }
+
     public static synchronized void updatePeerInfo(InetAddress ep, String columnName, String
value)
     {
         if (ep.equals(FBUtilities.getBroadcastAddress()))
@@ -267,6 +268,12 @@ public class SystemTable
         processInternal(String.format(req, PEERS_CF, columnName, ep.getHostAddress(), value));
     }
 
+    public static synchronized void updateSchemaVersion(UUID version)
+    {
+        String req = "INSERT INTO system.%s (key, schema_version) VALUES ('%s', %s)";
+        processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, version.toString()));
+    }
+
     private static String tokensAsSet(Collection<Token> tokens)
     {
         Token.TokenFactory factory = StorageService.getPartitioner().getTokenFactory();


Mime
View raw message