cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject svn commit: r1178843 - in /cassandra/branches/cassandra-1.0.0: CHANGES.txt src/java/org/apache/cassandra/cli/CliClient.java src/java/org/apache/cassandra/cli/CliUtils.java
Date Tue, 04 Oct 2011 15:57:00 GMT
Author: xedin
Date: Tue Oct  4 15:57:00 2011
New Revision: 1178843

URL: http://svn.apache.org/viewvc?rev=1178843&view=rev
Log:
Fix missing fields in CLI `show schema` output
patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-3304

Modified:
    cassandra/branches/cassandra-1.0.0/CHANGES.txt
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliUtils.java

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1178843&r1=1178842&r2=1178843&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Tue Oct  4 15:57:00 2011
@@ -13,7 +13,7 @@
  * Fix stress COUNTER_GET option (CASSANDRA-3301)
  * Change default heap thresholds to max(min(1/2 ram, 1G), min(1/4 ram, 8GB))
    (CASSANDRA-3295)
-
+ * Fix missing fields in CLI `show schema` output (CASSANDRA-3304)
 
 1.0.0-rc2
  * Log a meaningful warning when a node receives a message for a repair session

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java?rev=1178843&r1=1178842&r2=1178843&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java Tue
Oct  4 15:57:00 2011
@@ -1589,16 +1589,19 @@ public class CliClient
         if (ksDef.strategy_options != null && !ksDef.strategy_options.isEmpty())
         {
             final StringBuilder opts = new StringBuilder();
-            opts.append("[{");
+            opts.append("{");
             String prefix = "";
             for (Map.Entry<String, String> opt : ksDef.strategy_options.entrySet())
             {
                 opts.append(prefix + CliUtils.escapeSQLString(opt.getKey()) + " : " + CliUtils.escapeSQLString(opt.getValue()));
                 prefix = ", ";
             }
-            opts.append("}]");
+            opts.append("}");
             writeAttrRaw(sb, false, "strategy_options", opts.toString());
         }
+
+        writeAttr(sb, false, "durable_writes", ksDef.durable_writes);
+
         sb.append(";" + NEWLINE);
         sb.append(NEWLINE);
 
@@ -1624,7 +1627,7 @@ public class CliClient
 
         writeAttr(sb, true, "column_type", cfDef.column_type);
         writeAttr(sb, false, "comparator", normaliseType(cfDef.comparator_type, "org.apache.cassandra.db.marshal"));
-        if (cfDef.column_type == "Super")
+        if (cfDef.column_type.equals("Super"))
             writeAttr(sb, false, "subcomparator", normaliseType(cfDef.subcomparator_type,
"org.apache.cassandra.db.marshal"));
         if (!StringUtils.isEmpty(cfDef.default_validation_class))
             writeAttr(sb, false, "default_validation_class",
@@ -1633,6 +1636,7 @@ public class CliClient
                     normaliseType(cfDef.key_validation_class, "org.apache.cassandra.db.marshal"));
         writeAttr(sb, false, "rows_cached", cfDef.row_cache_size);
         writeAttr(sb, false, "row_cache_save_period", cfDef.row_cache_save_period_in_seconds);
+        writeAttr(sb, false, "row_cache_keys_to_save", cfDef.row_cache_keys_to_save);
         writeAttr(sb, false, "keys_cached", cfDef.key_cache_size);
         writeAttr(sb, false, "key_cache_save_period", cfDef.key_cache_save_period_in_seconds);
         writeAttr(sb, false, "read_repair_chance", cfDef.read_repair_chance);
@@ -1641,6 +1645,32 @@ public class CliClient
         writeAttr(sb, false, "max_compaction_threshold", cfDef.max_compaction_threshold);
         writeAttr(sb, false, "replicate_on_write", cfDef.replicate_on_write);
         writeAttr(sb, false, "row_cache_provider", normaliseType(cfDef.row_cache_provider,
"org.apache.cassandra.cache"));
+        writeAttr(sb, false, "compaction_strategy", cfDef.compaction_strategy);
+
+        if (!cfDef.compaction_strategy_options.isEmpty())
+        {
+            StringBuilder cOptions = new StringBuilder();
+
+            cOptions.append("{");
+
+            Map<String, String> options = cfDef.compaction_strategy_options;
+
+            int i = 0, size = options.size();
+
+            for (Map.Entry<String, String> entry : options.entrySet())
+            {
+                cOptions.append(CliUtils.quote(entry.getKey())).append(" : ").append(CliUtils.quote(entry.getValue()));
+
+                if (i != size - 1)
+                    cOptions.append(", ");
+
+                i++;
+            }
+
+            cOptions.append("}");
+
+            writeAttrRaw(sb, false, "compaction_strategy_options", cOptions.toString());
+        }
 
         if (!StringUtils.isEmpty(cfDef.comment))
             writeAttr(sb, false, "comment", cfDef.comment);

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliUtils.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliUtils.java?rev=1178843&r1=1178842&r2=1178843&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliUtils.java (original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliUtils.java Tue
Oct  4 15:57:00 2011
@@ -118,4 +118,9 @@ public class CliUtils
 
         return null;
     }
+
+    public static String quote(String str)
+    {
+        return String.format("'%s'", str);
+    }
 }



Mime
View raw message