cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [18/22] cassandra git commit: 9474 3.0
Date Fri, 04 Dec 2015 19:32:18 GMT
9474 3.0


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

Branch: refs/heads/cassandra-3.0
Commit: a4da379bb042fcf171a560af5edd9e785d6f8e4e
Parents: 8fd810c
Author: Marcus Olsson <marcus.olsson@ericsson.com>
Authored: Fri Dec 4 14:30:00 2015 -0500
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Fri Dec 4 14:30:00 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        | 18 +++-----
 .../org/apache/cassandra/db/SystemKeyspace.java | 15 ++++++
 .../cassandra/service/CassandraDaemon.java      | 15 ------
 .../apache/cassandra/service/StartupChecks.java | 48 +++++++++++++++++++-
 5 files changed, 70 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a4da379b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c22d138..8f3f182 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.1
+ * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
  * Handle single-column deletions correction in materialized views
    when the column is part of the view primary key (CASSANDRA-10796)
  * Fix issue with datadir migration on upgrade (CASSANDRA-10788)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a4da379b/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index b3c304a..d41384b 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -146,10 +146,13 @@ Deprecation
 
 Operations
 ----------
-    - Switching racks is no longer an allowed operation on a node which has
-      data. Instead, the node will need to be decommissioned and rebootstrapped.
-      If moving from the SimpleSnitch, make sure the rack containing all current
-      nodes is named "rack1".
+    - Switching data center or racks is no longer an allowed operation on a node
+      which has data. Instead, the node will need to be decommissioned and
+      rebootstrapped. If moving from the SimpleSnitch, make sure that the data
+      center and rack containing all current nodes is named "datacenter1" and
+      "rack1". To override this behaviour use -Dcassandra.ignore_rack=true and/or
+      -Dcassandra.ignore_dc=true.
+    - Reloading the configuration file of GossipingPropertyFileSnitch has been disabled.
 
 New features
 ------------
@@ -160,13 +163,6 @@ New features
     - Native protocol server now allows both SSL and non-SSL connections on
       the same port.
 
-Operations
-------------
-    - Changing rack or dc of live nodes is no longer possible for PropertyFileSnitch
-      and YamlFileNetworkTopologySnitch. Reloading the configuration file of
-      GossipingPropertyFileSnitch has been disabled, CASSANDRA-10243.
-
-
 2.2.3
 =====
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a4da379b/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 8a27c9d..205df8b 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -1068,6 +1068,21 @@ public final class SystemKeyspace
         return null;
     }
 
+    /**
+     * Gets the stored data center for the local node, or null if none have been set yet.
+     */
+    public static String getDatacenter()
+    {
+        String req = "SELECT data_center FROM system.%s WHERE key='%s'";
+        UntypedResultSet result = executeInternal(String.format(req, LOCAL, LOCAL));
+
+        // Look up the Data center (return it if found)
+        if (!result.isEmpty() && result.one().has("data_center"))
+            return result.one().getString("data_center");
+
+        return null;
+    }
+
     public static PaxosState loadPaxosState(DecoratedKey key, CFMetaData metadata)
     {
         String req = "SELECT * FROM system.%s WHERE row_key = ? AND cf_id = ?";

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a4da379b/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index f83152b..4af926a 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -241,21 +241,6 @@ public class CassandraDaemon
 
         Keyspace.setInitialized();
 
-        if (!Boolean.getBoolean("cassandra.ignore_rack"))
-        {
-            String storedRack = SystemKeyspace.getRack();
-            if (storedRack != null)
-            {
-                String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
-                if (!storedRack.equals(currentRack))
-                {
-                    logger.error("Cannot start node if snitch's rack differs from previous
rack. " +
-                                 "Please fix the snitch or decommission and rebootstrap this
node.");
-                    System.exit(100);
-                }
-            }
-        }
-
         // initialize keyspaces
         for (String keyspaceName : Schema.instance.getKeyspaces())
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a4da379b/src/java/org/apache/cassandra/service/StartupChecks.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StartupChecks.java b/src/java/org/apache/cassandra/service/StartupChecks.java
index ebe4b26..c2c5acc 100644
--- a/src/java/org/apache/cassandra/service/StartupChecks.java
+++ b/src/java/org/apache/cassandra/service/StartupChecks.java
@@ -75,7 +75,9 @@ public class StartupChecks
                                                                       initSigarLibrary,
                                                                       checkDataDirs,
                                                                       checkSSTablesFormat,
-                                                                      checkSystemKeyspaceState);
+                                                                      checkSystemKeyspaceState,
+                                                                      checkDatacenter,
+                                                                      checkRack);
 
     public StartupChecks withDefaultTests()
     {
@@ -300,4 +302,48 @@ public class StartupChecks
             }
         }
     };
+
+    public static final StartupCheck checkDatacenter = new StartupCheck()
+    {
+        public void execute() throws StartupException
+        {
+            if (!Boolean.getBoolean("cassandra.ignore_dc"))
+            {
+                String storedDc = SystemKeyspace.getDatacenter();
+                if (storedDc != null)
+                {
+                    String currentDc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress());
+                    if (!storedDc.equals(currentDc))
+                    {
+                        String formatMessage = "Cannot start node if snitch's data center
(%s) differs from previous data center (%s). " +
+                                               "Please fix the snitch configuration, decommission
and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true.";
+
+                        throw new StartupException(100, String.format(formatMessage, currentDc,
storedDc));
+                    }
+                }
+            }
+        }
+    };
+
+    public static final StartupCheck checkRack = new StartupCheck()
+    {
+        public void execute() throws StartupException
+        {
+            if (!Boolean.getBoolean("cassandra.ignore_rack"))
+            {
+                String storedRack = SystemKeyspace.getRack();
+                if (storedRack != null)
+                {
+                    String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
+                    if (!storedRack.equals(currentRack))
+                    {
+                        String formatMessage = "Cannot start node if snitch's rack (%s) differs
from previous rack (%s). " +
+                                               "Please fix the snitch configuration, decommission
and rebootstrap this node or use the flag -Dcassandra.ignore_rack=true.";
+
+                        throw new StartupException(100, String.format(formatMessage, currentRack,
storedRack));
+                    }
+                }
+            }
+        }
+    };
 }


Mime
View raw message