cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject git commit: Update gossip with schema version when merging from remote. Patch by brandonwilliams, reviewed by xedin for CASSANDRA-3931
Date Tue, 21 Feb 2012 19:27:55 GMT
Updated Branches:
  refs/heads/cassandra-1.1 83cfa9dd1 -> 527d590d4


Update gossip with schema version when merging from remote.
Patch by brandonwilliams, reviewed by xedin for CASSANDRA-3931


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

Branch: refs/heads/cassandra-1.1
Commit: 527d590d435073ebefab7369f77e7d3a04d5b651
Parents: 83cfa9d
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Tue Feb 21 12:30:06 2012 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Tue Feb 21 13:14:39 2012 -0600

----------------------------------------------------------------------
 src/java/org/apache/cassandra/config/Schema.java   |    9 +++++++++
 src/java/org/apache/cassandra/db/DefsTable.java    |    2 +-
 .../apache/cassandra/service/MigrationManager.java |    1 +
 .../apache/cassandra/service/StorageService.java   |    6 +++---
 4 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/527d590d/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 e1047c2..89c5d1e 100644
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@ -28,6 +28,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import com.google.common.collect.BiMap;
 import com.google.common.collect.HashBiMap;
+import org.apache.cassandra.service.MigrationManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -478,4 +479,12 @@ public class Schema
             versionLock.writeLock().unlock();
         }
     }
+    /*
+     * Like updateVersion, but also announces via gossip
+     */
+    public void updateVersionAndAnnounce()
+    {
+        updateVersion();
+        MigrationManager.passiveAnnounce(version);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/527d590d/src/java/org/apache/cassandra/db/DefsTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DefsTable.java b/src/java/org/apache/cassandra/db/DefsTable.java
index ca62a46..142e032 100644
--- a/src/java/org/apache/cassandra/db/DefsTable.java
+++ b/src/java/org/apache/cassandra/db/DefsTable.java
@@ -234,7 +234,7 @@ public class DefsTable
         if (!StorageService.instance.isClientMode())
             MigrationHelper.flushSchemaCFs();
 
-        Schema.instance.updateVersion();
+        Schema.instance.updateVersionAndAnnounce();
 
         Set<String> keyspacesToDrop = mergeKeyspaces(oldKeyspaces, SystemTable.getSchema(SystemTable.SCHEMA_KEYSPACES_CF));
         mergeColumnFamilies(oldColumnFamilies, SystemTable.getSchema(SystemTable.SCHEMA_COLUMNFAMILIES_CF));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/527d590d/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java
index 0d8df1d..d303d40 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -174,6 +174,7 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
      */
     public static void passiveAnnounce(UUID version)
     {
+        assert Gossiper.instance.isEnabled();
         Gossiper.instance.addLocalApplicationState(ApplicationState.SCHEMA, StorageService.instance.valueFactory.migration(version));
         logger.debug("Gossiping my schema version " + version);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/527d590d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 3635801..7a7bc7c 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -398,8 +398,7 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
             throw new IOError(ex);
         }
 
-        Schema.instance.updateVersion();
-        MigrationManager.passiveAnnounce(Schema.instance.getVersion());
+        Schema.instance.updateVersionAndAnnounce();
     }
 
     public synchronized void initServer() throws IOException, ConfigurationException
@@ -508,7 +507,6 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
         logger_.info("Starting up server gossip");
         joined = true;
 
-        Schema.instance.updateVersion();
 
         // have to start the gossip service before we can see any info on other nodes.  this
is necessary
         // for bootstrap to get the load info it needs.
@@ -516,6 +514,8 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
         Gossiper.instance.register(this);
         Gossiper.instance.register(migrationManager);
         Gossiper.instance.start(SystemTable.incrementAndGetGeneration()); // needed for node-ring
gathering.
+        // gossip schema version when gossiper is running
+        Schema.instance.updateVersionAndAnnounce();
         // add rpc listening info
         Gossiper.instance.addLocalApplicationState(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
         if (null != DatabaseDescriptor.getReplaceToken())


Mime
View raw message