cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1102359 - in /cassandra/branches/cassandra-0.8: ./ contrib/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/net/ src/java/org/apache/cassandra/service/ test/unit/org/a...
Date Thu, 12 May 2011 15:53:29 GMT
Author: jbellis
Date: Thu May 12 15:53:28 2011
New Revision: 1102359

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

Modified:
    cassandra/branches/cassandra-0.8/   (props changed)
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/contrib/   (props changed)
    cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
  (props changed)
    cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
  (props changed)
    cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/Cli.g
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/MessagingService.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AbstractRowResolver.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/DatacenterReadCallback.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/IResponseResolver.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/RangeSliceResponseResolver.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/ReadCallback.java
    cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cli/CliTest.java

Propchange: cassandra/branches/cassandra-0.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7:1026516-1102355
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /cassandra/trunk:1090978-1090979

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Thu May 12 15:53:28 2011
@@ -24,6 +24,7 @@
  * fix counting bloom filter true positives (CASSANDRA-2637)
  * initialize local ep state prior to gossip startup if needed (CASSANDRA-2638)
  * fix counter increment lost after restart (CASSANDRA-2642)
+ * add quote-escaping via backslash to CLI (CASSANDRA-2623)
 
 
 0.8.0-beta2

Propchange: cassandra/branches/cassandra-0.8/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
-/cassandra/branches/cassandra-0.7/contrib:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/contrib:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /cassandra/trunk/contrib:1090978-1090979

Propchange: cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090978-1090979

Propchange: cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090978-1090979

Propchange: cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090978-1090979

Propchange: cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090978-1090979

Propchange: cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:53:28 2011
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1101940,1102337
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1102355
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090978-1090979

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/Cli.g
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/Cli.g?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/Cli.g (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cli/Cli.g Thu May 12 15:53:28
2011
@@ -603,10 +603,57 @@ Identifier
 
 // literals
 StringLiteral
-    :
-    '\'' (~'\'')* '\'' ( '\'' (~'\'')* '\'' )*
+    : '\'' SingleStringCharacter* '\''
     ;
 
+fragment SingleStringCharacter
+	: ~('\'' | '\\')
+	| '\\' EscapeSequence
+	;
+
+fragment EscapeSequence
+	: CharacterEscapeSequence
+	| '0'
+	| HexEscapeSequence
+	| UnicodeEscapeSequence
+	;
+
+fragment CharacterEscapeSequence
+	: SingleEscapeCharacter
+	| NonEscapeCharacter
+	;
+
+fragment NonEscapeCharacter
+	: ~(EscapeCharacter)
+	;
+
+fragment SingleEscapeCharacter
+	: '\'' | '"' | '\\' | 'b' | 'f' | 'n' | 'r' | 't' | 'v'
+	;
+
+fragment EscapeCharacter
+	: SingleEscapeCharacter
+	| DecimalDigit
+	| 'x'
+	| 'u'
+	;
+
+fragment HexEscapeSequence
+	: 'x' HexDigit HexDigit
+	;
+
+fragment UnicodeEscapeSequence
+	: 'u' HexDigit HexDigit HexDigit HexDigit
+	;
+
+fragment HexDigit
+	: DecimalDigit | ('a'..'f') | ('A'..'F')
+	;
+
+fragment DecimalDigit
+	: ('0'..'9')
+	;
+
 //
 // syntactic elements
 //

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/MessagingService.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/MessagingService.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/MessagingService.java
Thu May 12 15:53:28 2011
@@ -280,6 +280,7 @@ public final class MessagingService impl
     public String sendRR(Message message, InetAddress to, IMessageCallback cb)
     {
         String id = nextId();
+        logger_.debug("Message id to {} is {}", to, id);
         addCallback(cb, id, to);
         sendOneWay(message, id, to);
         return id;
@@ -287,7 +288,9 @@ public final class MessagingService impl
 
     public void sendOneWay(Message message, InetAddress to)
     {
-        sendOneWay(message, nextId(), to);
+        String id = nextId();
+        logger_.debug("Message id to {} is {}", to, id);
+        sendOneWay(message, id, to);
     }
 
     public void sendReply(Message message, String id, InetAddress to)

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AbstractRowResolver.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AbstractRowResolver.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AbstractRowResolver.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AbstractRowResolver.java
Thu May 12 15:53:28 2011
@@ -55,16 +55,15 @@ public abstract class AbstractRowResolve
         this.table = table;
     }
 
-    public void preprocess(Message message)
+    public ReadResponse preprocess(Message message)
     {
         byte[] body = message.getMessageBody();
         ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
         try
         {
             ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn),
message.getVersion());
-            if (logger.isDebugEnabled())
-                logger.debug("Preprocessed {} response", result.isDigestQuery() ? "digest"
: "data");
             replies.put(message, result);
+            return result;
         }
         catch (IOException e)
         {

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/DatacenterReadCallback.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/DatacenterReadCallback.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/DatacenterReadCallback.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/DatacenterReadCallback.java
Thu May 12 15:53:28 2011
@@ -48,17 +48,11 @@ public class DatacenterReadCallback<T> e
     }
 
     @Override
-    protected boolean waitingFor(Message message)
-    {
-        return localdc.equals(snitch.getDatacenter(message.getFrom()));
-    }
-
-    @Override
-    protected boolean waitingFor(ReadResponse response)
+    protected boolean waitingFor(ReadResponse response, InetAddress from)
     {
         // cheat and leverage our knowledge that a local read is the only way the ReadResponse
         // version of this method gets called
-        return true;
+        return localdc.equals(snitch.getDatacenter(from));
     }
         
     @Override

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/IResponseResolver.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/IResponseResolver.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/IResponseResolver.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/IResponseResolver.java
Thu May 12 15:53:28 2011
@@ -20,6 +20,7 @@ package org.apache.cassandra.service;
 
 import java.io.IOException;
 
+import org.apache.cassandra.db.ReadResponse;
 import org.apache.cassandra.net.Message;
 
 public interface IResponseResolver<T> {
@@ -41,6 +42,6 @@ public interface IResponseResolver<T> {
      */
     public T getData() throws IOException;
 
-    public void preprocess(Message message);
+    public ReadResponse preprocess(Message message);
     public Iterable<Message> getMessages();
 }

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/RangeSliceResponseResolver.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/RangeSliceResponseResolver.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/RangeSliceResponseResolver.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/RangeSliceResponseResolver.java
Thu May 12 15:53:28 2011
@@ -24,16 +24,11 @@ import java.util.*;
 import java.util.concurrent.LinkedBlockingQueue;
 
 import com.google.common.collect.AbstractIterator;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
 import org.apache.commons.collections.iterators.CollatingIterator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RangeSliceReply;
-import org.apache.cassandra.db.Row;
+import org.apache.cassandra.db.*;
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.utils.Pair;
 import org.apache.cassandra.utils.ReducingIterator;
@@ -114,7 +109,7 @@ public class RangeSliceResponseResolver 
         };
     }
 
-    public void preprocess(Message message)
+    public ReadResponse preprocess(Message message)
     {
         responses.add(message);
     }

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/ReadCallback.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/ReadCallback.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/ReadCallback.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/ReadCallback.java
Thu May 12 15:53:28 2011
@@ -42,6 +42,7 @@ import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.thrift.ConsistencyLevel;
 import org.apache.cassandra.thrift.UnavailableException;
+import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.SimpleCondition;
 import org.apache.cassandra.utils.WrappedRunnable;
 
@@ -125,10 +126,13 @@ public class ReadCallback<T> implements 
 
     public void response(Message message)
     {
-        resolver.preprocess(message);
-        int n = waitingFor(message)
+        ReadResponse result = resolver.preprocess(message);
+        int n = waitingFor(result, message.getFrom())
               ? received.incrementAndGet()
               : received.get();
+        if (logger.isDebugEnabled())
+            logger.debug("{} response; {} qualifying responses seen.  Data is {}present",
+                         new Object[] { result.isDigestQuery() ? "digest" : "data", n, resolver.isDataPresent()
? "" : "not " });
         if (n >= blockfor && resolver.isDataPresent())
         {
             condition.signal();
@@ -137,18 +141,9 @@ public class ReadCallback<T> implements 
     }
 
     /**
-     * @return true if the message counts towards the blockfor threshold
-     * TODO turn the Message into a response so we don't need two versions of this method
-     */
-    protected boolean waitingFor(Message message)
-    {
-        return true;
-    }
-
-    /**
      * @return true if the response counts towards the blockfor threshold
      */
-    protected boolean waitingFor(ReadResponse response)
+    protected boolean waitingFor(ReadResponse response, InetAddress from)
     {
         return true;
     }
@@ -156,7 +151,9 @@ public class ReadCallback<T> implements 
     public void response(ReadResponse result)
     {
         ((RowDigestResolver) resolver).injectPreProcessed(result);
-        int n = waitingFor(result)
+        if (logger.isDebugEnabled())
+            logger.debug("Preprocessed {} response", result.isDigestQuery() ? "digest" :
"data");
+        int n = waitingFor(result, FBUtilities.getLocalAddress())
               ? received.incrementAndGet()
               : received.get();
         if (n >= blockfor && resolver.isDataPresent())

Modified: cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cli/CliTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1102359&r1=1102358&r2=1102359&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cli/CliTest.java Thu May
12 15:53:28 2011
@@ -40,9 +40,14 @@ public class CliTest extends CleanupHelp
         "create column family CF1 with comparator=UTF8Type and column_metadata=[{ column_name:world,
validation_class:IntegerType, index_type:0, index_name:IdxName }, { column_name:world2, validation_class:LongType,
index_type:KEYS, index_name:LongIdxName}];",
         "assume CF1 keys as utf8;",
         "set CF1[hello][world] = 123848374878933948398384;",
+        "set CF1[hello][test_quote] = 'value\\'';",
+        "set CF1['k\\'ey'][VALUE] = 'VAL';",
+        "set CF1['k\\'ey'][VALUE] = 'VAL\\'';",
         "set CF1[hello][-31337] = 'some string value';",
         "get CF1[hello][-31337];",
         "get CF1[hello][world];",
+        "get CF1[hello][test_quote];",
+        "get CF1['k\\'ey'][VALUE]",
         "set CF1[hello][-31337] = -23876;",
         "set CF1[hello][-31337] = long(-23876);",
         "set CF1[hello][world2] = 15;",



Mime
View raw message