Fix propertyFileSnitch default DC/Rack behavior

patch by slebresne; reviewed by jbellis for CASSANDRA-5285


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

Branch: refs/heads/trunk
Commit: 7093813870088a8fd4ddacd5a0c29a5fa3c65f9e
Parents: 7c920b0
Author: Sylvain Lebresne <[email protected]>
Authored: Fri Mar 1 17:04:00 2013 +0100
Committer: Sylvain Lebresne <[email protected]>
Committed: Fri Mar 1 17:04:00 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../cassandra/locator/PropertyFileSnitch.java      |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/70938138/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 231de9c..fd6547f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
  * Fix composite comparator with super columns (CASSANDRA-5287)
  * Fix insufficient validation of UPDATE queries against counter cfs
    (CASSANDRA-5300)
+ * Fix PropertyFileSnitch default DC/Rack behavior (CASSANDRA-5285)
 Merged from 1.1:
  * nodetool: ability to repair specific range (CASSANDRA-5280)
  * Fix possible assertion triggered in SliceFromReadCommand (CASSANDRA-5284)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/70938138/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java 
b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
index 7083b5e..da440af 100644
--- a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
+++ b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
@@ -181,8 +181,8 @@ public class PropertyFileSnitch extends 
AbstractNetworkTopologySnitch
                 reloadedMap.put(host, token);
             }
         }
-        if (!reloadedMap.containsKey(FBUtilities.getBroadcastAddress()))
-            throw new ConfigurationException(String.format("Snitch definitions 
at %s do not define a location for this node's broadcast address %s",
+        if (defaultDCRack == null && 
!reloadedMap.containsKey(FBUtilities.getBroadcastAddress()))
+            throw new ConfigurationException(String.format("Snitch definitions 
at %s do not define a location for this node's broadcast address %s, nor does 
it provides a default",
                                                            
SNITCH_PROPERTIES_FILENAME, FBUtilities.getBroadcastAddress()));
 
         logger.debug("loaded network topology {}", 
FBUtilities.toString(reloadedMap));

Reply via email to