Disable reloading of GossipingPropertyFileSnitch Patch by molsson; reviewed by pmotta for CASSANDRA-9474
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f6deca3d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f6deca3d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f6deca3d Branch: refs/heads/trunk Commit: f6deca3db2ec173c8d0b2cd33ef2660012ae3f69 Parents: acdbba7 Author: Marcus Olsson <[email protected]> Authored: Fri Dec 4 14:21:15 2015 -0500 Committer: Joshua McKenzie <[email protected]> Committed: Fri Dec 4 14:21:15 2015 -0500 ---------------------------------------------------------------------- CHANGES.txt | 1 + NEWS.txt | 16 +++++++-------- .../org/apache/cassandra/db/SystemKeyspace.java | 21 +++++++++++++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f6deca3d/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 1a2887a..46cda65 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.13 + * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474) * Fix Stress profile parsing on Windows (CASSANDRA-10808) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f6deca3d/NEWS.txt ---------------------------------------------------------------------- diff --git a/NEWS.txt b/NEWS.txt index cae8dfb..7a15d02 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -24,20 +24,18 @@ New features - DTCS option max_sstable_age_days is now deprecated and defaults to 1000 days. - Native protocol server now allows both SSL and non-SSL connections on the same port. - - 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". To override this behavior when manually wiping - the node and bootstrapping, use -Dcassandra.ignore_rack=true. - a new validate(key, cf) method is added to PerRowSecondaryIndex. A default implementation is provided, so no changes are required to custom implementations. 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. - + - 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. 2.1.11 ===== http://git-wip-us.apache.org/repos/asf/cassandra/blob/f6deca3d/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 c600652..1f66b1b 100644 --- a/src/java/org/apache/cassandra/db/SystemKeyspace.java +++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java @@ -614,11 +614,26 @@ public class SystemKeyspace } } - if (!Boolean.getBoolean("cassandra.ignore_rack")) + String req = "SELECT rack, data_center FROM system.%s WHERE key='%s'"; + UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY)); + + if (!Boolean.getBoolean("cassandra.ignore_dc")) { - String req = "SELECT rack FROM system.%s WHERE key='%s'"; - UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY)); + // Look up the dc (return it if found) + if (!result.isEmpty() && result.one().has("data_center")) + { + String storedDc = result.one().getString("data_center"); + String currentDc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress()); + if (!storedDc.equals(currentDc)) + { + throw new ConfigurationException("Cannot start node if snitch's data center (" + currentDc + ") differs from previous data center (" + storedDc + "). " + + "Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true."); + } + } + } + if (!Boolean.getBoolean("cassandra.ignore_rack")) + { // Look up the Rack (return it if found) if (!result.isEmpty() && result.one().has("rack")) {
