You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2015/12/04 20:32:12 UTC
[12/22] cassandra git commit: 9474 2.2
9474 2.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/879c49bb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/879c49bb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/879c49bb
Branch: refs/heads/trunk
Commit: 879c49bb7d28946187a04e5cd76236d652825579
Parents: 1a00f00
Author: Marcus Olsson <ma...@ericsson.com>
Authored: Fri Dec 4 14:22:36 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Fri Dec 4 14:22:36 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/879c49bb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7932f51..34866fa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.5
+ * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
* Verify tables in pseudo-system keyspaces at startup (CASSANDRA-10761)
Merged from 2.1:
* Fix Stress profile parsing on Windows (CASSANDRA-10808)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/879c49bb/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 87e77f4..e220357 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -26,10 +26,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
------------
@@ -40,13 +43,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/879c49bb/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 1807101..46de0db 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -880,6 +880,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(ByteBuffer 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/879c49bb/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 59609a3..eb05324 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -232,21 +232,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/879c49bb/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 8b8810c..c13b401 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()
{
@@ -302,4 +304,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));
+ }
+ }
+ }
+ }
+ };
}