re-allow wrapping ranges for start_token/end_token range pairing
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-5106


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ccdb632d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ccdb632d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ccdb632d

Branch: refs/heads/trunk
Commit: ccdb632d4005165efdc65dfa3aa0a1799ae0a87b
Parents: f481a39
Author: Jonathan Ellis <[email protected]>
Authored: Thu Jan 10 12:50:32 2013 -0600
Committer: Jonathan Ellis <[email protected]>
Committed: Thu Jan 10 12:50:41 2013 -0600

----------------------------------------------------------------------
 .../apache/cassandra/thrift/ThriftValidation.java  |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ccdb632d/src/java/org/apache/cassandra/thrift/ThriftValidation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/ThriftValidation.java 
b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
index f9733d6..bc64018 100644
--- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
@@ -507,13 +507,12 @@ public class ThriftValidation
                     throw new InvalidRequestException("start key's md5 sorts 
after end key's md5.  this is not allowed; you probably should not specify end 
key at all, under RandomPartitioner");
             }
         }
-        else if (range.end_token != null)
+        else if (range.start_key != null && range.end_token != null)
         {
+            // start_token/end_token can wrap, but key/token should not
             RowPosition stop = 
p.getTokenFactory().fromString(range.end_token).maxKeyBound(p);
-            if (range.start_key != null && RowPosition.forKey(range.start_key, 
p).compareTo(stop) > 0)
+            if (RowPosition.forKey(range.start_key, p).compareTo(stop) > 0)
                 throw new InvalidRequestException("Start key's token sorts 
after end token");
-            if (range.start_token != null && 
p.getTokenFactory().fromString(range.start_token).maxKeyBound(p).compareTo(stop)
 > 0)
-                throw new InvalidRequestException("Start token sorts after end 
token");
         }
 
         validateFilterClauses(metadata, range.row_filter);

Reply via email to