cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1029511 - in /cassandra/trunk: ./ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/concurrent/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/dht/ src/...
Date Sun, 31 Oct 2010 23:10:00 GMT
Author: jbellis
Date: Sun Oct 31 23:09:59 2010
New Revision: 1029511

URL: http://svn.apache.org/viewvc?rev=1029511&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/CliUserHelp.java
    cassandra/trunk/src/java/org/apache/cassandra/concurrent/Stage.java
    cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
    cassandra/trunk/src/java/org/apache/cassandra/net/Message.java
    cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
    cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6:922689-1028722
-/cassandra/branches/cassandra-0.7:1026517-1028835
+/cassandra/branches/cassandra-0.7:1026517-1029424
 /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=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Sun Oct 31 23:09:59 2010
@@ -6,6 +6,9 @@ dev
  * fix IntegerType.getString (CASSANDRA-1681)
  * log tpstats when dropping messages (CASSANDRA-1660)
  * make -Djava.net.preferIPv4Stack=true the default (CASSANDRA-628)
+ * make -Djava.net.preferIPv4Stack=true the default (CASSANDRA-628)
+ * add INTERNAL_RESPONSE verb to differentiate from responses related
+   to client requests (CASSANDRA-1685)
 
 
 0.7.0-beta3

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1028722
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1028835
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1029424
 /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 Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1028722
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1028835
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1029424
 /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 Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1028722
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1028835
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1029424
 /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 Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1028722
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1028835
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1029424
 /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 Sun Oct 31 23:09:59 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1028722
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1028835
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1029424
 /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=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g Sun Oct 31 23:09:59 2010
@@ -42,7 +42,7 @@ tokens {
     NODE_NO_OP;
     NODE_SHOW_CLUSTER_NAME;
     NODE_SHOW_VERSION;
-    NODE_SHOW_TABLES;
+    NODE_SHOW_KEYSPACES;
     NODE_THRIFT_GET;
     NODE_THRIFT_GET_WITH_CONDITIONS;
     NODE_THRIFT_SET;
@@ -87,7 +87,22 @@ package org.apache.cassandra.cli;
 {
     public void reportError(RecognitionException e) 
     {
-        throw new RuntimeException("Syntax error at position " + e.charPositionInLine + ":
" + this.getErrorMessage(e, this.getTokenNames()));
+        StringBuilder errorMessage = new StringBuilder("Syntax error at position " + e.charPositionInLine
+ ": ");
+
+        if (e instanceof NoViableAltException)
+        {
+            int index = e.charPositionInLine;
+            String error = this.input.substring(index, index);
+            String statement = this.input.substring(0, this.input.size() - 1);
+
+            errorMessage.append("unexpected \"" + error + "\" for `" + statement + "`.");
+        }
+        else
+        {
+            errorMessage.append(this.getErrorMessage(e, this.getTokenNames()));
+        }
+
+        throw new RuntimeException(errorMessage.toString());
     }
 }
 
@@ -95,7 +110,18 @@ package org.apache.cassandra.cli;
 {
     public void reportError(RecognitionException e) 
     {
-        throw new RuntimeException("Syntax error at position " + e.charPositionInLine + ":
" + this.getErrorMessage(e, this.getTokenNames()));
+        String errorMessage;
+
+        if (e instanceof NoViableAltException)
+        {
+            errorMessage = "Command not found: `" + this.input + "`. Type 'help' or '?' for
help.";
+        }
+        else
+        {
+            errorMessage = "Syntax error at position " + e.charPositionInLine + ": " + this.getErrorMessage(e,
this.getTokenNames());
+        }
+
+        throw new RuntimeException(errorMessage);
     }
 }
 
@@ -117,7 +143,7 @@ statement
     | updateColumnFamily
     | delColumnFamily
     | delKeyspace
-    | useTable
+    | useKeyspace
     | delStatement
     | getStatement
     | helpStatement
@@ -129,70 +155,70 @@ statement
     ;
 
 connectStatement
-    : K_CONNECT host SLASH port 
+    : CONNECT host '/' port 
         -> ^(NODE_CONNECT host port)
-    | K_CONNECT ipaddr SLASH port 
-        -> ^(NODE_CONNECT ipaddr port)
+    | CONNECT ip_address '/' port 
+        -> ^(NODE_CONNECT ip_address port)
     ;
 
 helpStatement
-    : K_HELP K_HELP 
+    : HELP HELP 
         -> ^(NODE_HELP NODE_HELP)
-    | K_HELP K_CONNECT 
+    | HELP CONNECT 
         -> ^(NODE_HELP NODE_CONNECT)
-    | K_HELP K_USE 
+    | HELP USE 
         -> ^(NODE_HELP NODE_USE_TABLE)
-    | K_HELP K_DESCRIBE K_TABLE 
+    | HELP DESCRIBE KEYSPACE 
         -> ^(NODE_HELP NODE_DESCRIBE_TABLE)
-    | K_HELP K_EXIT 
+    | HELP EXIT 
         -> ^(NODE_HELP NODE_EXIT)
-    | K_HELP K_QUIT 
+    | HELP QUIT 
         -> ^(NODE_HELP NODE_EXIT)
-    | K_HELP K_SHOW K_CLUSTER K_NAME 
+    | HELP SHOW CLUSTER NAME 
         -> ^(NODE_HELP NODE_SHOW_CLUSTER_NAME)
-    | K_HELP K_SHOW K_TABLES 
-        -> ^(NODE_HELP NODE_SHOW_TABLES)
-    | K_HELP K_SHOW K_VERSION 
+    | HELP SHOW KEYSPACES 
+        -> ^(NODE_HELP NODE_SHOW_KEYSPACES)
+    | HELP SHOW VERSION 
         -> ^(NODE_HELP NODE_SHOW_VERSION)
-    | K_HELP K_CREATE K_TABLE 
+    | HELP CREATE KEYSPACE 
         -> ^(NODE_HELP NODE_ADD_KEYSPACE)
-    | K_HELP K_UPDATE K_TABLE
+    | HELP UPDATE KEYSPACE
         -> ^(NODE_HELP NODE_UPDATE_KEYSPACE)
-    | K_HELP K_CREATE K_COLUMN K_FAMILY 
+    | HELP CREATE COLUMN FAMILY 
         -> ^(NODE_HELP NODE_ADD_COLUMN_FAMILY)
-    | K_HELP K_UPDATE K_COLUMN K_FAMILY
+    | HELP UPDATE COLUMN FAMILY
         -> ^(NODE_HELP NODE_UPDATE_COLUMN_FAMILY)
-    | K_HELP K_DROP K_TABLE 
+    | HELP DROP KEYSPACE 
         -> ^(NODE_HELP NODE_DEL_KEYSPACE)
-    | K_HELP K_DROP K_COLUMN K_FAMILY 
+    | HELP DROP COLUMN FAMILY 
         -> ^(NODE_HELP NODE_DEL_COLUMN_FAMILY)
-    | K_HELP K_GET 
+    | HELP GET 
         -> ^(NODE_HELP NODE_THRIFT_GET)
-    | K_HELP K_SET 
+    | HELP SET 
         -> ^(NODE_HELP NODE_THRIFT_SET)
-    | K_HELP K_DEL 
+    | HELP DEL 
         -> ^(NODE_HELP NODE_THRIFT_DEL)
-    | K_HELP K_COUNT 
+    | HELP COUNT 
         -> ^(NODE_HELP NODE_THRIFT_COUNT)
-    | K_HELP K_LIST 
+    | HELP LIST 
         -> ^(NODE_HELP NODE_LIST)
-    | K_HELP K_TRUNCATE
+    | HELP TRUNCATE
         -> ^(NODE_HELP NODE_TRUNCATE)
-    | K_HELP 
+    | HELP 
         -> ^(NODE_HELP)
     | '?'    
         -> ^(NODE_HELP)
     ;
 
 exitStatement
-    : K_QUIT -> ^(NODE_EXIT)
-    | K_EXIT -> ^(NODE_EXIT)
+    : QUIT -> ^(NODE_EXIT)
+    | EXIT -> ^(NODE_EXIT)
     ;
 
 getStatement
-    : K_GET columnFamilyExpr ('AS' typeIdentifier)?
+    : GET columnFamilyExpr ('AS' typeIdentifier)?
         -> ^(NODE_THRIFT_GET columnFamilyExpr ( ^(CONVERT_TO_TYPE typeIdentifier) )? )
-    | K_GET columnFamily 'WHERE' getCondition ('AND' getCondition)* ('LIMIT' limit=IntegerLiteral)*
+    | GET columnFamily 'WHERE' getCondition ('AND' getCondition)* ('LIMIT' limit=IntegerLiteral)*
         -> ^(NODE_THRIFT_GET_WITH_CONDITIONS columnFamily ^(CONDITIONS getCondition+)
^(NODE_LIMIT $limit)*) 
     ;
 
@@ -210,99 +236,100 @@ typeIdentifier
     ;
 
 setStatement
-    : K_SET columnFamilyExpr '=' value 
+    : SET columnFamilyExpr '=' value 
         -> ^(NODE_THRIFT_SET columnFamilyExpr value)
     ;
 
 countStatement
-    : K_COUNT columnFamilyExpr 
+    : COUNT columnFamilyExpr 
         -> ^(NODE_THRIFT_COUNT columnFamilyExpr)
     ;
 
 delStatement
-    : K_DEL columnFamilyExpr 
+    : DEL columnFamilyExpr 
         -> ^(NODE_THRIFT_DEL columnFamilyExpr)
     ;
 
 showStatement
     : showClusterName
     | showVersion
-    | showTables
+    | showKeyspaces
     ;
 
 listStatement
-    : K_LIST columnFamily keyRangeExpr? ('LIMIT' limit=IntegerLiteral)?
+    : LIST columnFamily keyRangeExpr? ('LIMIT' limit=IntegerLiteral)?
         -> ^(NODE_LIST columnFamily keyRangeExpr? ^(NODE_LIMIT $limit)?)
     ;
 
 truncateStatement
-    : K_TRUNCATE columnFamily
+    : TRUNCATE columnFamily
         -> ^(NODE_TRUNCATE columnFamily)
     ;
 
 showClusterName
-    : K_SHOW K_CLUSTER K_NAME 
+    : SHOW CLUSTER NAME 
         -> ^(NODE_SHOW_CLUSTER_NAME)
     ;
 
 addKeyspace
-    : K_CREATE K_TABLE keyValuePairExpr 
+    : CREATE KEYSPACE keyValuePairExpr 
         -> ^(NODE_ADD_KEYSPACE keyValuePairExpr)
     ;
 
 addColumnFamily
-    : K_CREATE K_COLUMN K_FAMILY keyValuePairExpr 
+    : CREATE COLUMN FAMILY keyValuePairExpr 
         -> ^(NODE_ADD_COLUMN_FAMILY keyValuePairExpr)
     ;
 
 updateKeyspace
-    : K_UPDATE K_TABLE keyValuePairExpr
+    : UPDATE KEYSPACE keyValuePairExpr
         -> ^(NODE_UPDATE_KEYSPACE keyValuePairExpr)
     ;
 
 updateColumnFamily
-    : K_UPDATE K_COLUMN K_FAMILY keyValuePairExpr
+    : UPDATE COLUMN FAMILY keyValuePairExpr
         -> ^(NODE_UPDATE_COLUMN_FAMILY keyValuePairExpr)
     ;
 
 delKeyspace
-    : K_DROP K_TABLE keyspace 
+    : DROP KEYSPACE keyspace 
         -> ^(NODE_DEL_KEYSPACE keyspace)
     ;
 
 delColumnFamily
-    : K_DROP K_COLUMN K_FAMILY columnFamily 
+    : DROP COLUMN FAMILY columnFamily 
         -> ^(NODE_DEL_COLUMN_FAMILY columnFamily)
     ;
 
 showVersion
-    : K_SHOW K_VERSION 
+    : SHOW VERSION 
         -> ^(NODE_SHOW_VERSION)
     ;
 
-showTables
-    : K_SHOW K_TABLES 
-        -> ^(NODE_SHOW_TABLES)
+showKeyspaces
+    : SHOW KEYSPACES 
+        -> ^(NODE_SHOW_KEYSPACES)
     ;
 
 describeTable
-    : K_DESCRIBE K_TABLE table 
-        -> ^(NODE_DESCRIBE_TABLE table)
+    : DESCRIBE KEYSPACE keyspace 
+        -> ^(NODE_DESCRIBE_TABLE keyspace)
     ;
     
-useTable
-    : K_USE table ( username )? ( password )? 
-        -> ^(NODE_USE_TABLE table ( username )? ( password )?)
+useKeyspace
+    : USE keyspace ( username )? ( password )? 
+        -> ^(NODE_USE_TABLE keyspace ( username )? ( password )?)
     ;
 
 
 keyValuePairExpr
-    : objectName ( (K_AND | K_WITH) keyValuePair )* 
+    : objectName ( (AND | WITH) keyValuePair )* 
         -> ^(NODE_NEW_KEYSPACE_ACCESS objectName ( keyValuePair )* )
     ;
             
 keyValuePair 
-    : attr_name '=' attrValue -> attr_name attrValue
+    : attr_name '=' attrValue 
+    	-> attr_name attrValue
     ;
 
 attrValue
@@ -328,58 +355,87 @@ hashElementPair
         -> ^(PAIR rowKey value)
     ;
 
-
-
 columnFamilyExpr
     : columnFamily '[' rowKey ']' 
-        ( '[' a+=columnOrSuperColumn ']' 
-            ('[' a+=columnOrSuperColumn ']')? 
+        ( '[' column=columnOrSuperColumn ']' 
+            ('[' super_column=columnOrSuperColumn ']')? 
         )?
-      -> ^(NODE_COLUMN_ACCESS columnFamily rowKey ($a+)?)
+      -> ^(NODE_COLUMN_ACCESS columnFamily rowKey ($column ($super_column)? )?)
     ;
 
 keyRangeExpr
     :    '[' ( startKey? ':' endKey? )? ']'
       -> ^(NODE_KEY_RANGE startKey? endKey?)
     ;
-    
-table: Identifier;
-
-columnName: Identifier;
 
-attr_name: Identifier;
-
-attrValueString: (Identifier | StringLiteral);
+columnName
+	: Identifier
+	;
+
+attr_name
+	: Identifier
+	;
+
+attrValueString
+	: (Identifier | StringLiteral)
+	;
       
-attrValueInt: IntegerLiteral;
-
-attrValueDouble: DoubleLiteral;
+attrValueInt
+	: IntegerLiteral
+	;
+
+attrValueDouble
+	: DoubleLiteral
+	;
   
-objectName: Identifier;
-
-keyspace: Identifier;
-
-replica_placement_strategy: StringLiteral;
-
-replication_factor: IntegerLiteral;
-
-keyspaceNewName: Identifier;
-
-comparator: StringLiteral;
+objectName
+	: Identifier
+	;
+
+keyspace
+	: Identifier
+	;
+
+replica_placement_strategy
+	: StringLiteral
+	;
+
+replication_factor
+	: IntegerLiteral
+	;
+
+keyspaceNewName
+	: Identifier
+	;
+
+comparator
+	: StringLiteral
+	;
       
-command: Identifier;
+command	: Identifier
+	;
 
-newColumnFamily: Identifier;
-
-username: Identifier;
-
-password: StringLiteral;
-
-columnFamily: Identifier;
-
-rowKey:   (Identifier | StringLiteral);
-
-value: (Identifier | IntegerLiteral | StringLiteral | functionCall );
+newColumnFamily
+	: Identifier
+	;
+
+username: Identifier
+	;
+
+password: StringLiteral
+	;
+
+columnFamily
+	: Identifier
+	;
+
+rowKey	
+    :   (Identifier | StringLiteral)
+	;
+
+value	
+    : (Identifier | IntegerLiteral | StringLiteral | functionCall)
+	;
 
 functionCall 
     : functionName=Identifier '(' functionArgument ')'
@@ -390,17 +446,36 @@ functionArgument 
     : Identifier | StringLiteral | IntegerLiteral
     ;
 
-startKey: (Identifier | StringLiteral);
-
-endKey: (Identifier | StringLiteral);
-
-columnOrSuperColumn: (Identifier | IntegerLiteral | StringLiteral);
-
-host: id+=Identifier (id+=DOT id+=Identifier)* -> ^(NODE_ID_LIST $id+);
+startKey
+    : (Identifier | StringLiteral)
+	;
+
+endKey	
+    : (Identifier | StringLiteral)
+	;
+
+columnOrSuperColumn
+	: (Identifier | IntegerLiteral | StringLiteral)
+	;
+
+host	
+    : host_name
+        -> ^(NODE_ID_LIST host_name)
+	;
+
+host_name
+	: Identifier ('.' Identifier)*
+	;
+	
+ip_address
+	: IP_ADDRESS 
+	    -> ^(NODE_ID_LIST IP_ADDRESS)
+	;
 
-ipaddr: id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT
id+=IntegerLiteral -> ^(NODE_ID_LIST $id+);
 
-port: IntegerLiteral;
+port	
+    : IntegerLiteral
+	;
 
 //
 // Lexer Section
@@ -412,34 +487,38 @@ port: IntegerLiteral;
 // CLI is case-insensitive with respect to these keywords.
 // However, they MUST be listed in upper case here.
 // 
-K_CONFIG:     'CONFIG';
-K_CONNECT:    'CONNECT';
-K_COUNT:      'COUNT';
-K_CLUSTER:    'CLUSTER';
-K_DEL:        'DEL';
-K_DESCRIBE:   'DESCRIBE';
-K_USE:        'USE';
-K_GET:        'GET';
-K_HELP:       'HELP';
-K_EXIT:       'EXIT';
-K_FILE:       'FILE';
-K_NAME:       'NAME';
-K_QUIT:       'QUIT';
-K_SET:        'SET';
-K_SHOW:       'SHOW';
-K_TABLE:      'KEYSPACE';
-K_TABLES:     'KEYSPACES';
-K_VERSION:    'API VERSION';
-K_CREATE:     'CREATE';
-K_DROP:       'DROP';
-K_COLUMN:     'COLUMN';
-K_FAMILY:     'FAMILY';
-K_WITH:       'WITH';
-K_AND:        'AND';
-K_UPDATE:     'UPDATE';
-K_LIST:       'LIST';
-K_LIMIT:      'LIMIT';
-K_TRUNCATE:   'TRUNCATE';
+CONFIG:     'CONFIG';
+CONNECT:    'CONNECT';
+COUNT:      'COUNT';
+CLUSTER:    'CLUSTER';
+DEL:        'DEL';
+DESCRIBE:   'DESCRIBE';
+USE:        'USE';
+GET:        'GET';
+HELP:       'HELP';
+EXIT:       'EXIT';
+FILE:       'FILE';
+NAME:       'NAME';
+QUIT:       'QUIT';
+SET:        'SET';
+SHOW:       'SHOW';
+KEYSPACE:   'KEYSPACE';
+KEYSPACES:  'KEYSPACES';
+VERSION:    'API VERSION';
+CREATE:     'CREATE';
+DROP:       'DROP';
+COLUMN:     'COLUMN';
+FAMILY:     'FAMILY';
+WITH:       'WITH';
+AND:        'AND';
+UPDATE:     'UPDATE';
+LIST:       'LIST';
+LIMIT:      'LIMIT';
+TRUNCATE:   'TRUNCATE';
+
+IP_ADDRESS 
+    : IntegerLiteral '.' IntegerLiteral '.' IntegerLiteral '.' IntegerLiteral
+    ;
 
 // private syntactic rules
 fragment
@@ -465,7 +544,7 @@ IntegerLiteral
    ;
    
 DoubleLiteral
-   : Digit+ DOT Digit+;
+   : Digit+ '.' Digit+;
 
 Identifier
     : (Letter | Alnum) (Alnum | '_' | '-' )*
@@ -481,14 +560,6 @@ StringLiteral
 // syntactic elements
 //
 
-DOT
-    : '.'
-    ;
-	
-SLASH
-    : '/'
-    ;
-
 SEMICOLON
     : ';'
     ;

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=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Sun Oct 31 23:09:59 2010
@@ -156,7 +156,7 @@ public class CliClient extends CliUserHe
                 case CliParser.NODE_SHOW_VERSION:
                     executeShowVersion();
                     break;
-                case CliParser.NODE_SHOW_TABLES:
+                case CliParser.NODE_SHOW_KEYSPACES:
                     executeShowKeySpaces();
                     break;
                 case CliParser.NODE_DESCRIBE_TABLE:

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=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java Sun Oct 31 23:09:59
2010
@@ -119,7 +119,7 @@ public class CliUserHelp {
                 state.out.println("Displays the API version number.");
                 break;
 
-            case CliParser.NODE_SHOW_TABLES:
+            case CliParser.NODE_SHOW_KEYSPACES:
                 state.out.println("show keyspaces\n");
                 state.out.println("Displays a list of the keyspaces available on the currently
connected cluster.");
                 break;

Modified: cassandra/trunk/src/java/org/apache/cassandra/concurrent/Stage.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Stage.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/concurrent/Stage.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/concurrent/Stage.java Sun Oct 31 23:09:59
2010
@@ -27,10 +27,11 @@ public enum Stage
     MUTATION,
     STREAM,
     GOSSIP,
-    RESPONSE,
+    REQUEST_RESPONSE,
     ANTIENTROPY,
     MIGRATION,
-    MISC;
+    MISC,
+    INTERNAL_RESPONSE;
 
     public String getJmxType()
     {
@@ -41,10 +42,11 @@ public enum Stage
             case MIGRATION:
             case MISC:
             case STREAM:
+            case INTERNAL_RESPONSE:
                 return "internal";
             case MUTATION:
             case READ:
-            case RESPONSE:
+            case REQUEST_RESPONSE:
                 return "request";
             default:
                 throw new AssertionError("Unknown stage " + this);

Modified: cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java Sun Oct 31
23:09:59 2010
@@ -42,7 +42,8 @@ public class StageManager
     {
         stages.put(Stage.MUTATION, multiThreadedConfigurableStage(Stage.MUTATION, getConcurrentWriters()));
         stages.put(Stage.READ, multiThreadedConfigurableStage(Stage.READ, getConcurrentReaders()));
       
-        stages.put(Stage.RESPONSE, multiThreadedStage(Stage.RESPONSE, Math.max(2, Runtime.getRuntime().availableProcessors())));
+        stages.put(Stage.REQUEST_RESPONSE, multiThreadedStage(Stage.REQUEST_RESPONSE, Math.max(2,
Runtime.getRuntime().availableProcessors())));
+        stages.put(Stage.INTERNAL_RESPONSE, multiThreadedStage(Stage.INTERNAL_RESPONSE, Math.max(1,
Runtime.getRuntime().availableProcessors())));
         // the rest are all single-threaded
         stages.put(Stage.STREAM, new JMXEnabledThreadPoolExecutor(Stage.STREAM));
         stages.put(Stage.GOSSIP, new JMXEnabledThreadPoolExecutor(Stage.GOSSIP));

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java Sun Oct 31
23:09:59 2010
@@ -31,11 +31,10 @@ public class SchemaCheckVerbHandler impl
 {
     private final Logger logger = LoggerFactory.getLogger(SchemaCheckVerbHandler.class);
     
-    @Override
     public void doVerb(Message message)
     {
         logger.debug("Received schema check request.");
-        Message response = message.getReply(FBUtilities.getLocalAddress(), DatabaseDescriptor.getDefsVersion().toString().getBytes());
+        Message response = message.getInternalReply(DatabaseDescriptor.getDefsVersion().toString().getBytes());
         MessagingService.instance.sendOneWay(response, message.getFrom());
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java Sun Oct 31 23:09:59
2010
@@ -254,7 +254,7 @@ public class BootStrapper
         {
             StorageService ss = StorageService.instance;
             String tokenString = StorageService.getPartitioner().getTokenFactory().toString(ss.getBootstrapToken());
-            Message response = message.getReply(FBUtilities.getLocalAddress(), tokenString.getBytes(Charsets.UTF_8));
+            Message response = message.getInternalReply(tokenString.getBytes(Charsets.UTF_8));
             MessagingService.instance.sendOneWay(response, message.getFrom());
         }
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java Sun Oct
31 23:09:59 2010
@@ -29,7 +29,6 @@ import java.lang.management.ManagementFa
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.AbstractStatsDeque;
@@ -181,7 +180,7 @@ public class DynamicEndpointSnitch exten
     {
         if (!registered)
         {
-       	    ILatencyPublisher handler = (ILatencyPublisher)MessagingService.instance.getVerbHandler(StorageService.Verb.READ_RESPONSE);
+       	    ILatencyPublisher handler = (ILatencyPublisher)MessagingService.instance.getVerbHandler(StorageService.Verb.REQUEST_RESPONSE);
             if (handler != null)
             {
                 handler.register(this);

Modified: cassandra/trunk/src/java/org/apache/cassandra/net/Message.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/net/Message.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/net/Message.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/net/Message.java Sun Oct 31 23:09:59 2010
@@ -26,6 +26,7 @@ import java.net.InetAddress;
 import org.apache.cassandra.concurrent.Stage;
 import org.apache.cassandra.io.ICompactSerializer;
 import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class Message
 {
@@ -101,10 +102,16 @@ public class Message
     // TODO should take byte[] + length so we don't have to copy to a byte[] of exactly the
right len
     public Message getReply(InetAddress from, byte[] args)
     {
-        Header header = new Header(getMessageId(), from, StorageService.Verb.READ_RESPONSE);
+        Header header = new Header(getMessageId(), from, StorageService.Verb.REQUEST_RESPONSE);
         return new Message(header, args);
     }
-    
+
+    public Message getInternalReply(byte[] body)
+    {
+        Header header = new Header(getMessageId(), FBUtilities.getLocalAddress(), StorageService.Verb.INTERNAL_RESPONSE);
+        return new Message(header, body);
+    }
+
     public String toString()
     {
         StringBuilder sbuf = new StringBuilder("");

Modified: cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java Sun Oct
31 23:09:59 2010
@@ -42,7 +42,9 @@ class OutboundTcpConnectionPool
     OutboundTcpConnection getConnection(Message msg)
     {
         Stage stage = msg.getMessageType();
-        return stage == Stage.RESPONSE || stage == Stage.GOSSIP ? ackCon : cmdCon;
+        return stage == Stage.REQUEST_RESPONSE || stage == Stage.INTERNAL_RESPONSE || stage
== Stage.GOSSIP
+               ? ackCon
+               : cmdCon;
     }
 
     synchronized void reset()

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java Sun Oct
31 23:09:59 2010
@@ -23,7 +23,6 @@ import java.io.DataInputStream;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -33,8 +32,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.lang.StringUtils;
 
-import org.apache.cassandra.concurrent.Stage;
-import org.apache.cassandra.concurrent.StageManager;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.ReadCommand;
@@ -166,7 +163,7 @@ class ConsistencyChecker implements Runn
             ReadResponse.serializer().serialize(readResponse, out);
             byte[] bytes = new byte[out.getLength()];
             System.arraycopy(out.getData(), 0, bytes, 0, bytes.length);
-            responses_.add(new Message(FBUtilities.getLocalAddress(), StorageService.Verb.READ_RESPONSE,
bytes));
+            responses_.add(new Message(FBUtilities.getLocalAddress(), StorageService.Verb.INTERNAL_RESPONSE,
bytes));
         }
 
         // synchronized so the " == majority" is safe

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java Sun Oct
31 23:09:59 2010
@@ -148,7 +148,7 @@ public class StorageLoadBalancer impleme
     {
         public void doVerb(Message message)
         {
-            Message reply = message.getReply(FBUtilities.getLocalAddress(), new byte[] {(byte)(isMoveable_.get()
? 1 : 0)});
+            Message reply = message.getInternalReply(new byte[] {(byte)(isMoveable_.get()
? 1 : 0)});
             MessagingService.instance.sendOneWay(reply, message.getFrom());
             if ( isMoveable_.get() )
             {

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Sun Oct 31 23:09:59
2010
@@ -145,7 +145,7 @@ public class StorageService implements I
         BINARY,
         READ_REPAIR,
         READ,
-        READ_RESPONSE,
+        REQUEST_RESPONSE, // client-initiated reads and writes
         STREAM_INITIATE, // Deprecated
         STREAM_INITIATE_DONE, // Deprecated
         STREAM_REPLY,
@@ -164,6 +164,7 @@ public class StorageService implements I
         SCHEMA_CHECK,
         INDEX_SCAN,
         REPLICATION_FINISHED,
+        INTERNAL_RESPONSE, // responses to internal calls
         ;
         // remember to add new verbs at the end, since we serialize by ordinal
     }
@@ -175,7 +176,7 @@ public class StorageService implements I
         put(Verb.BINARY, Stage.MUTATION);
         put(Verb.READ_REPAIR, Stage.MUTATION);
         put(Verb.READ, Stage.READ);
-        put(Verb.READ_RESPONSE, Stage.RESPONSE);
+        put(Verb.REQUEST_RESPONSE, Stage.REQUEST_RESPONSE);
         put(Verb.STREAM_REPLY, Stage.MISC); // TODO does this really belong on misc? I've
just copied old behavior here
         put(Verb.STREAM_REQUEST, Stage.STREAM);
         put(Verb.RANGE_SLICE, Stage.READ);
@@ -191,6 +192,7 @@ public class StorageService implements I
         put(Verb.SCHEMA_CHECK, Stage.MIGRATION);
         put(Verb.INDEX_SCAN, Stage.READ);
         put(Verb.REPLICATION_FINISHED, Stage.MISC);
+        put(Verb.INTERNAL_RESPONSE, Stage.INTERNAL_RESPONSE);
     }};
 
 
@@ -284,7 +286,8 @@ public class StorageService implements I
         MessagingService.instance.registerVerbHandlers(Verb.STREAM_REQUEST, new StreamRequestVerbHandler()
);
         MessagingService.instance.registerVerbHandlers(Verb.STREAM_REPLY, new StreamReplyVerbHandler());
         MessagingService.instance.registerVerbHandlers(Verb.REPLICATION_FINISHED, new ReplicationFinishedVerbHandler());
-        MessagingService.instance.registerVerbHandlers(Verb.READ_RESPONSE, new ResponseVerbHandler());
+        MessagingService.instance.registerVerbHandlers(Verb.REQUEST_RESPONSE, new ResponseVerbHandler());
+        MessagingService.instance.registerVerbHandlers(Verb.INTERNAL_RESPONSE, new ResponseVerbHandler());
         MessagingService.instance.registerVerbHandlers(Verb.TREE_REQUEST, new TreeRequestVerbHandler());
         MessagingService.instance.registerVerbHandlers(Verb.TREE_RESPONSE, new AntiEntropyService.TreeResponseVerbHandler());
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java
Sun Oct 31 23:09:59 2010
@@ -20,6 +20,7 @@ package org.apache.cassandra.streaming;
  * 
  */
 
+import org.apache.commons.lang.ArrayUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,7 +37,7 @@ public class ReplicationFinishedVerbHand
     public void doVerb(Message msg)
     {
         StorageService.instance.confirmReplication(msg.getFrom());
-        Message response = msg.getReply(FBUtilities.getLocalAddress(), new byte[]{});
+        Message response = msg.getInternalReply(ArrayUtils.EMPTY_BYTE_ARRAY);
         if (logger.isDebugEnabled())
             logger.debug("Replying to " + msg.getMessageId() + "@" + msg.getFrom());
         MessagingService.instance.sendOneWay(response, msg.getFrom());

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java?rev=1029511&r1=1029510&r2=1029511&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java Sun Oct 31 23:09:59
2010
@@ -1,53 +1,53 @@
 /**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*    http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 package org.apache.cassandra.service;
 
 import java.io.IOException;
 import java.net.InetAddress;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.concurrent.Stage;
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.dht.*;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.RandomPartitioner;
+import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.gms.VersionedValue;
-import org.apache.cassandra.locator.AbstractReplicationStrategy;
-import org.apache.cassandra.locator.SimpleSnitch;
 import org.apache.cassandra.locator.TokenMetadata;
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.net.sink.IMessageSink;
 import org.apache.cassandra.net.sink.SinkManager;
 import org.apache.cassandra.streaming.StreamUtil;
-import org.apache.cassandra.streaming.StreamRequestVerbHandler;
 import org.apache.cassandra.utils.FBUtilities;
 
+import static org.junit.Assert.*;
+
 public class RemoveTest extends CleanupHelper
 {
     StorageService ss = StorageService.instance;
@@ -58,7 +58,8 @@ public class RemoveTest extends CleanupH
     List<InetAddress> hosts;
 
     @Before
-    public void setup() throws IOException {
+    public void setup() throws IOException
+    {
         tmd.clearUnsafe();
         IPartitioner partitioner = new RandomPartitioner();
 
@@ -73,36 +74,40 @@ public class RemoveTest extends CleanupH
 
         MessagingService.instance.listen(FBUtilities.getLocalAddress());
         Gossiper.instance.start(FBUtilities.getLocalAddress(), 1);
-        for(int i = 0; i < 6; i++) {
+        for (int i = 0; i < 6; i++)
+        {
             Gossiper.instance.initializeNodeUnsafe(hosts.get(i), 1);
         }
     }
 
     @After
-    public void tearDown() {
+    public void tearDown()
+    {
         SinkManager.clearSinks();
-        MessagingService.instance.shutdown();
+        MessagingService.shutdown();
         ss.setPartitionerUnsafe(oldPartitioner);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
-    public void testBadToken() {
-        final String token = ss.getPartitioner().getTokenFactory().toString(keyTokens.get(2));
+    @Test(expected = UnsupportedOperationException.class)
+    public void testBadToken()
+    {
+        final String token = StorageService.getPartitioner().getTokenFactory().toString(keyTokens.get(2));
         ss.removeToken(token);
 
     }
 
-    @Test(expected=UnsupportedOperationException.class)
-    public void testLocalToken() {
+    @Test(expected = UnsupportedOperationException.class)
+    public void testLocalToken()
+    {
         //first token should be localhost
-        final String token = ss.getPartitioner().getTokenFactory().toString(endpointTokens.get(0));
+        final String token = StorageService.getPartitioner().getTokenFactory().toString(endpointTokens.get(0));
         ss.removeToken(token);
     }
 
     @Test
     public void testRemoveToken() throws InterruptedException
     {
-        IPartitioner partitioner = ss.getPartitioner();
+        IPartitioner partitioner = StorageService.getPartitioner();
 
         final String token = partitioner.getTokenFactory().toString(endpointTokens.get(5));
         ReplicationSink rSink = new ReplicationSink();
@@ -110,15 +115,15 @@ public class RemoveTest extends CleanupH
 
         // start removal in background and send replication confirmations
         final AtomicBoolean success = new AtomicBoolean(false);
-        Thread remover =  new Thread() 
+        Thread remover = new Thread()
         {
-            public void run() 
+            public void run()
             {
-                try 
+                try
                 {
                     ss.removeToken(token);
                 }
-                catch (Exception e )
+                catch (Exception e)
                 {
                     System.err.println(e);
                     e.printStackTrace();
@@ -134,7 +139,8 @@ public class RemoveTest extends CleanupH
         assertTrue(tmd.isLeaving(hosts.get(5)));
         assertEquals(1, tmd.getLeavingEndpoints().size());
 
-        for(InetAddress host : hosts) {
+        for (InetAddress host : hosts)
+        {
             Message msg = new Message(host, StorageService.Verb.REPLICATION_FINISHED, new
byte[0]);
             MessagingService.instance.sendRR(msg, FBUtilities.getLocalAddress());
         }
@@ -148,7 +154,7 @@ public class RemoveTest extends CleanupH
     @Test
     public void testStartRemoving()
     {
-        IPartitioner partitioner = ss.getPartitioner();
+        IPartitioner partitioner = StorageService.getPartitioner();
         VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner);
 
         NotificationSink nSink = new NotificationSink();
@@ -170,7 +176,7 @@ public class RemoveTest extends CleanupH
     @Test
     public void testFinishRemoving()
     {
-        IPartitioner partitioner = ss.getPartitioner();
+        IPartitioner partitioner = StorageService.getPartitioner();
         VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner);
 
         assertEquals(0, tmd.getLeavingEndpoints().size());
@@ -183,10 +189,12 @@ public class RemoveTest extends CleanupH
         assertFalse(tmd.isMember(hosts.get(5)));
     }
 
-    class ReplicationSink implements IMessageSink {
+    class ReplicationSink implements IMessageSink
+    {
 
-        public Message handleMessage(Message msg, InetAddress to) {
-            if(!msg.getVerb().equals(StorageService.Verb.STREAM_REQUEST))
+        public Message handleMessage(Message msg, InetAddress to)
+        {
+            if (!msg.getVerb().equals(StorageService.Verb.STREAM_REQUEST))
                 return msg;
 
             StreamUtil.finishStreamRequest(msg, to);
@@ -195,16 +203,18 @@ public class RemoveTest extends CleanupH
         }
     }
 
-    class NotificationSink implements IMessageSink {
+    class NotificationSink implements IMessageSink
+    {
         public int callCount = 0;
 
-        public Message handleMessage(Message msg, InetAddress to) {
-            if(msg.getVerb().equals(StorageService.Verb.REPLICATION_FINISHED))
+        public Message handleMessage(Message msg, InetAddress to)
+        {
+            if (msg.getVerb().equals(StorageService.Verb.REPLICATION_FINISHED))
             {
                 callCount++;
                 assertEquals(Stage.MISC, msg.getMessageType());
                 // simulate a response from remote server
-                Message response = msg.getReply(FBUtilities.getLocalAddress(), new byte[]{});
+                Message response = msg.getReply(FBUtilities.getLocalAddress(), new byte[]{
});
                 MessagingService.instance.sendOneWay(response, FBUtilities.getLocalAddress());
                 return null;
             }



Mime
View raw message