cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1062875 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/service/StorageService.java src/java/org/apache/cassandra/service/StorageServiceMBean.java
Date Mon, 24 Jan 2011 16:55:25 GMT
Author: jbellis
Date: Mon Jan 24 16:55:24 2011
New Revision: 1062875

URL: http://svn.apache.org/viewvc?rev=1062875&view=rev
Log:
added option to specify -Dcassandra.join_ring=false on startup
patch by slebresne; reviewed by jbellis for CASSANDRA-526

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1062875&r1=1062874&r2=1062875&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Mon Jan 24 16:55:24 2011
@@ -30,6 +30,9 @@
  * add short options for CLI flags (CASSANDRA-1565)
  * make keyspace argument to "describe keyspace" in CLI optional
    when authenticated to keyspace already (CASSANDRA-2029)
+ * added option to specify -Dcassandra.join_ring=false on startup
+   to allow "warm spare" nodes or performing JMX maintenance before
+   joining the ring (CASSANDRA-526)
 
 
 0.7.0-final

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1062875&r1=1062874&r2=1062875&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
Mon Jan 24 16:55:24 2011
@@ -177,6 +177,7 @@ public class StorageService implements I
     /* when intialized as a client, we shouldn't write to the system table. */
     private boolean isClientMode;
     private boolean initialized;
+    private volatile boolean joined = false;
     private String operationMode;
     private MigrationManager migrationManager = new MigrationManager();
 
@@ -341,7 +342,20 @@ public class StorageService implements I
             }
         }
 
+        if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true")))
+        {
+            joinTokenRing();
+        }
+        else
+        {
+            logger_.info("Not joining ring as requested. Use JMX (StorageService->joinRing())
to initiate ring joining");
+        }
+    }
+
+    private void joinTokenRing() throws IOException, org.apache.cassandra.config.ConfigurationException
+    {
         logger_.info("Starting up server gossip");
+        joined = true;
 
         // 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.
@@ -411,6 +425,20 @@ public class StorageService implements I
         assert tokenMetadata_.sortedTokens().size() > 0;
     }
 
+    public synchronized void joinRing() throws IOException, org.apache.cassandra.config.ConfigurationException
+    {
+        if (!joined)
+        {
+            logger_.info("Joining ring by operator request");
+            joinTokenRing();
+        }
+    }
+
+    public boolean isJoined()
+    {
+        return joined;
+    }
+
     private void setMode(String m, boolean log)
     {
         operationMode = m;

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java?rev=1062875&r1=1062874&r2=1062875&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
Mon Jan 24 16:55:24 2011
@@ -282,4 +282,8 @@ public interface StorageServiceMBean
 
     public void invalidateKeyCaches(String ks, String... cfs) throws IOException;
     public void invalidateRowCaches(String ks, String... cfs) throws IOException;
+
+    // allows a node that have been started without joining the ring to join it
+    public void joinRing() throws IOException, org.apache.cassandra.config.ConfigurationException;
+    public boolean isJoined();
 }



Mime
View raw message