cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/5] git commit: warn on invalid replication strategy creation options patch by dbrosius; reviewed by jbellis for CASSANDRA-4046
Date Wed, 09 May 2012 16:29:05 GMT
warn on invalid replication strategy creation options
patch by dbrosius; reviewed by jbellis for CASSANDRA-4046


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

Branch: refs/heads/cassandra-1.1
Commit: fd66ccf21f1331fd2bd07611ad8dd5bf4be5f83b
Parents: 16d4c6c
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed May 9 11:28:40 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed May 9 11:28:40 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 ++
 .../locator/AbstractReplicationStrategy.java       |    9 +++++++++
 .../apache/cassandra/locator/LocalStrategy.java    |    1 +
 .../apache/cassandra/locator/SimpleStrategy.java   |    3 +++
 4 files changed, 15 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd66ccf2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index baf899f..f17ffd1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1.1-dev
+ * enable caching on index CFs based on data CF cache setting (CASSANDRA-4197)
+ * warn on invalid replication strategy creation options (CASSANDRA-4046)
  * remove [Freeable]Memory finalizers (CASSANDRA-4222)
  * include tombstone size in ColumnFamily.size, which can prevent OOM
    during sudden mass delete operations (CASSANDRA-3741)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd66ccf2/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java b/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
index dccc850..288818c 100644
--- a/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
+++ b/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
@@ -251,4 +251,13 @@ public abstract class AbstractReplicationStrategy
             throw new ConfigurationException("Replication factor must be numeric; found "
+ rf);
         }
     }
+
+    protected void warnOnUnexpectedOptions(Collection<String> expectedOptions)
+    {
+        for (String key : configOptions.keySet())
+        {
+            if (expectedOptions.contains(key))
+                logger.warn("Unrecognized strategy option {" + key + "} passed to " + getClass().getSimpleName()
+ " for keyspace " + table);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd66ccf2/src/java/org/apache/cassandra/locator/LocalStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/LocalStrategy.java b/src/java/org/apache/cassandra/locator/LocalStrategy.java
index f2804da..381d64f 100644
--- a/src/java/org/apache/cassandra/locator/LocalStrategy.java
+++ b/src/java/org/apache/cassandra/locator/LocalStrategy.java
@@ -48,5 +48,6 @@ public class LocalStrategy extends AbstractReplicationStrategy
     public void validateOptions() throws ConfigurationException
     {
         // LocalStrategy doesn't expect any options.
+        warnOnUnexpectedOptions(Arrays.<String>asList());
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fd66ccf2/src/java/org/apache/cassandra/locator/SimpleStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/SimpleStrategy.java b/src/java/org/apache/cassandra/locator/SimpleStrategy.java
index 024e9d4..1cffd74 100644
--- a/src/java/org/apache/cassandra/locator/SimpleStrategy.java
+++ b/src/java/org/apache/cassandra/locator/SimpleStrategy.java
@@ -21,6 +21,7 @@ package org.apache.cassandra.locator;
 
 import java.net.InetAddress;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -28,6 +29,7 @@ import java.util.Map;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.dht.Token;
 
+
 /**
  * This class returns the nodes responsible for a given
  * key but does not respect rack awareness. Basically
@@ -70,6 +72,7 @@ public class SimpleStrategy extends AbstractReplicationStrategy
         {
             throw new ConfigurationException("SimpleStrategy requires a replication_factor
strategy option.");
         }
+        warnOnUnexpectedOptions(Arrays.<String>asList("replication_factor"));
         validateReplicationFactor(configOptions.get("replication_factor"));
     }
 }


Mime
View raw message