cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1027460 - in /cassandra/trunk: ./ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ test/unit/org/apache/cassandra/cli/
Date Tue, 26 Oct 2010 11:00:12 GMT
Author: jbellis
Date: Tue Oct 26 11:00:11 2010
New Revision: 1027460

URL: http://svn.apache.org/viewvc?rev=1027460&view=rev
Log:
merge from 0.7

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java 
 (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props
changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliCompleter.java
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6:922689-1024328
-/cassandra/branches/cassandra-0.7:1026517-1027349
+/cassandra/branches/cassandra-0.6:922689-1027458
+/cassandra/branches/cassandra-0.7:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5:888872-915439

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Tue Oct 26 11:00:11 2010
@@ -59,6 +59,8 @@
    the old ones (CASSANDRA-1644)
  * upgrade to Thrift 0.5 (CASSANDRA-1367)
  * renamed CL.DCQUORUM to LOCAL_QUORUM and DCQUORUMSYNC to EACH_QUORUM
+ * cli truncate support (CASSANDRA-1653)
+ * update GC settings in cassandra.bat (CASSANDRA-1636)
 
 
 0.7-beta2

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1024328
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1027349
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1027458
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Cassandra.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1024328
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1027349
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1027458
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Column.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1024328
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1027349
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1027458
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1024328
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1027349
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1027458
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 11:00:11 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1024328
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1027349
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1027458
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1027459
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:888872-903502

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g?rev=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g Tue Oct 26 11:00:11 2010
@@ -55,6 +55,7 @@ tokens {
     NODE_UPDATE_KEYSPACE;
     NODE_UPDATE_COLUMN_FAMILY;
     NODE_LIST;
+    NODE_TRUNCATE;
 
     // Internal Nodes.
     NODE_COLUMN_ACCESS;
@@ -123,6 +124,7 @@ statement
     | setStatement
     | showStatement
     | listStatement
+    | truncateStatement
     | -> ^(NODE_NO_OP)
     ;
 
@@ -174,6 +176,8 @@ helpStatement
         -> ^(NODE_HELP NODE_THRIFT_COUNT)
     | K_HELP K_LIST 
         -> ^(NODE_HELP NODE_LIST)
+    | K_HELP K_TRUNCATE
+        -> ^(NODE_HELP NODE_TRUNCATE)
     | K_HELP 
         -> ^(NODE_HELP)
     | '?'    
@@ -231,6 +235,11 @@ listStatement
         -> ^(NODE_LIST columnFamily keyRangeExpr? ^(NODE_LIMIT $limit)?)
     ;
 
+truncateStatement
+    : K_TRUNCATE columnFamily
+        -> ^(NODE_TRUNCATE columnFamily)
+    ;
+
 showClusterName
     : K_SHOW K_CLUSTER K_NAME 
         -> ^(NODE_SHOW_CLUSTER_NAME)
@@ -430,6 +439,7 @@ K_AND:        'AND';
 K_UPDATE:     'UPDATE';
 K_LIST:       'LIST';
 K_LIMIT:      'LIMIT';
+K_TRUNCATE:   'TRUNCATE';
 
 // private syntactic rules
 fragment

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=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Tue Oct 26 11:00:11 2010
@@ -171,6 +171,9 @@ public class CliClient extends CliUserHe
                 case CliParser.NODE_LIST:
                     executeList(tree);
                     break;
+                case CliParser.NODE_TRUNCATE:
+                    executeTruncate(tree.getChild(0).getText());
+                    break;
                 case CliParser.NODE_NO_OP:
                     // comment lines come here; they are treated as no ops.
                     break;
@@ -943,6 +946,30 @@ public class CliClient extends CliUserHe
         printSliceList(columnFamilyDef, keySlices);
     }
 
+    // TRUNCATE <columnFamily>
+    private void executeTruncate(String columnFamily)
+    {
+        if (!CliMain.isConnected() || !hasKeySpace())
+            return;
+
+        // getting CfDef, it will fail if there is no such column family in current keySpace.

+        CfDef cfDef = getCfDef(columnFamily);
+
+        try
+        {
+            thriftClient.truncate(cfDef.getName());
+            sessionState.out.println(columnFamily + " truncated.");
+        }
+        catch (InvalidRequestException e)
+        {
+            throw new RuntimeException(e.getWhy());
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
     // SHOW API VERSION
     private void executeShowVersion() throws TException
     {

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliCompleter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliCompleter.java?rev=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliCompleter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliCompleter.java Tue Oct 26 11:00:11
2010
@@ -55,12 +55,16 @@ public class CliCompleter extends Simple
             "help set",
             "help del",
             "help count",
+            "help list",
+            "help truncate"
     };
     private static String[] keyspaceCommands = {
             "get",
             "set",
             "count",
-            "del"
+            "del",
+            "list",
+            "truncate"
     };
 
     public CliCompleter()

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java?rev=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java Tue Oct 26 11:00:11
2010
@@ -281,6 +281,13 @@ public class CliUserHelp {
                 state.out.println("list Users[j:] limit 40");
                 break;
 
+            case CliParser.NODE_TRUNCATE:
+                state.out.println("truncate <column_family>");
+                state.out.println("Truncate specified column family.\n");
+                state.out.println("example:");
+                state.out.println("truncate Category");
+                break;
+            
             default:
                 state.out.println("?");
                 break;
@@ -324,7 +331,8 @@ public class CliUserHelp {
             state.out.println("del <cf>['<key>']['<super>']['<col>']
                        Delete sub column.");
             state.out.println("count <cf>['<key>']                          
          Count columns in record.");
             state.out.println("count <cf>['<key>']['<super>']         
        Count columns in a super column.");
-            state.out.println("list <cf>                                  List all
rows in the column family.");
+            state.out.println("truncate <column_family>                       Truncate
specified column family.");            
+            state.out.println("list <cf>                                    List all
rows in the column family.");
             state.out.println("list <cf>[<startKey>:]");
             state.out.println("                       List rows in the column family beginning
with <startKey>.");
             state.out.println("list <cf>[<startKey>:<endKey>]");

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=1027460&r1=1027459&r2=1027460&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Tue Oct 26 11:00:11 2010
@@ -52,6 +52,7 @@ public class CliTest extends TestCase
         "list CF3[h:]",
         "list CF3 limit 10",
         "list CF3[h:g] limit 10",
+        "truncate CF1",
         "update keyspace TestKeySpace with placement_strategy='org.apache.cassandra.locator.LocalStrategy'",
         "update keyspace TestKeySpace with replication_factor=1 and strategy_options=[{DC1:3,
DC2:4, DC5:1}]"
     };
@@ -101,6 +102,10 @@ public class CliTest extends TestCase
                     assertTrue(result.startsWith("=> (column="));
                 }
             }
+            else if (statement.startsWith("truncate "))
+            {
+                assertTrue(result.contains(" truncated."));
+            }
 
             outStream.reset(); // reset stream so we have only output from next statement
all the time
             errStream.reset(); // no errors to the end user.



Mime
View raw message