cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject svn commit: r1166367 - in /cassandra/trunk: CHANGES.txt src/java/org/apache/cassandra/cli/CliClient.java test/unit/org/apache/cassandra/cli/CliTest.java
Date Wed, 07 Sep 2011 20:07:39 GMT
Author: xedin
Date: Wed Sep  7 20:07:38 2011
New Revision: 1166367

URL: http://svn.apache.org/viewvc?rev=1166367&view=rev
Log:
Fix inconsistency of the CLI syntax when {} should be used instead of [{}]
patch by Jake Luciani; reviewed by Pavel Yaskevich for CASSANDRA-3119

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1166367&r1=1166366&r2=1166367&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Wed Sep  7 20:07:38 2011
@@ -64,7 +64,8 @@
  * fix of the CQL count() behavior (CASSANDRA-3068)
  * use TreeMap backed column families for the SSTable simple writers
    (CASSANDRA-3148)
-
+ * fix inconsistency of the CLI syntax when {} should be used instead of [{}]
+   (CASSANDRA-3119)
 
 0.8.5
  * fix NPE when encryption_options is unspecified (CASSANDRA-3007)

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1166367&r1=1166366&r2=1166367&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Wed Sep  7 20:07:38 2011
@@ -25,6 +25,8 @@ import java.nio.ByteBuffer;
 import java.nio.charset.CharacterCodingException;
 import java.util.*;
 
+import antlr.Token;
+
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import org.apache.commons.lang.StringUtils;
@@ -2438,9 +2440,20 @@ public class CliClient
      */
     private Map<String, String> getStrategyOptionsFromTree(Tree options)
     {
+        //Check for old [{}] syntax
+        if (options.getText().equalsIgnoreCase("ARRAY"))
+        {
+            System.err.println("WARNING: [{}] strategy_options syntax is deprecated, please
use {}");
+
+            if (options.getChildCount() == 0)
+                return Collections.EMPTY_MAP;
+
+            return getStrategyOptionsFromTree(options.getChild(0));
+        }
+
         // this map will be returned
         Map<String, String> strategyOptions = new HashMap<String, String>();
-               
+
         // each child node is ^(PAIR $key $value)
         for (int j = 0; j < options.getChildCount(); j++)
         {

Modified: cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1166367&r1=1166366&r2=1166367&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Wed Sep  7 20:07:38 2011
@@ -129,6 +129,7 @@ public class CliTest extends CleanupHelp
         "drop index on CF3.'big world';",
         "update keyspace TestKeySpace with placement_strategy='org.apache.cassandra.locator.LocalStrategy'
and durable_writes = false;",
         "update keyspace TestKeySpace with strategy_options={DC1:3, DC2:4, DC5:1};",
+        "update keyspace TestKeySpace with strategy_options=[{DC1:3, DC2:4, DC5:1}];",
         "assume 123 comparator as utf8;",
         "assume 123 sub_comparator as integer;",
         "assume 123 validator as lexicaluuid;",



Mime
View raw message