You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (Created) (JIRA)" <ji...@apache.org> on 2012/01/17 16:03:40 UTC
[jira] [Created] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Allow rangeSlice queries to be start/end inclusive/exclusive
-------------------------------------------------------------
Key: CASSANDRA-3749
URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
Project: Cassandra
Issue Type: Sub-task
Components: Core
Reporter: Sylvain Lebresne
Assignee: Sylvain Lebresne
Fix For: 1.1
Attachments: 3749.patch
Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Posted by "Jonathan Ellis (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189141#comment-13189141 ]
Jonathan Ellis commented on CASSANDRA-3749:
-------------------------------------------
+1
> Allow rangeSlice queries to be start/end inclusive/exclusive
> -------------------------------------------------------------
>
> Key: CASSANDRA-3749
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
> Project: Cassandra
> Issue Type: Sub-task
> Components: Core
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Fix For: 1.1
>
> Attachments: 3749-comments.txt, 3749-v2.patch, 3749.patch
>
>
> Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Posted by "Jonathan Ellis (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189142#comment-13189142 ]
Jonathan Ellis commented on CASSANDRA-3749:
-------------------------------------------
Actually my comment change was not quite correct:
{code}
+ * Given token T and AbstractBounds ?L,R?, returns Pair(?L,T], [T,R?),
{code}
should be
{code}
+ * Given token T and AbstractBounds ?L,R?, returns Pair(?L,T], (T,R?),
{code}
> Allow rangeSlice queries to be start/end inclusive/exclusive
> -------------------------------------------------------------
>
> Key: CASSANDRA-3749
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
> Project: Cassandra
> Issue Type: Sub-task
> Components: Core
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Fix For: 1.1
>
> Attachments: 3749-comments.txt, 3749-v2.patch, 3749.patch
>
>
> Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Posted by "Jonathan Ellis (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Ellis updated CASSANDRA-3749:
--------------------------------------
Attachment: 3749-comments.txt
Even after updating the comments to make things a bit more clear (attached), I'm still confused by the remainder/split dance. For instance, if we are splitting a Bounds on bounds.right, that means that remainder overlaps Bounds entirely and so we should add that to the ranges, but instead we skip it.
> Allow rangeSlice queries to be start/end inclusive/exclusive
> -------------------------------------------------------------
>
> Key: CASSANDRA-3749
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
> Project: Cassandra
> Issue Type: Sub-task
> Components: Core
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Fix For: 1.1
>
> Attachments: 3749-comments.txt, 3749.patch
>
>
> Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Posted by "Sylvain Lebresne (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sylvain Lebresne updated CASSANDRA-3749:
----------------------------------------
Attachment: 3749.patch
Patch attached (includes a unit test). Mainly, the patch introduces two new AbstractBounds classes to represent (k1, k2) an [k1, k2). The patch is however longer than that due to a few technicalities:
* There was a bug in Token.KeyBound comparisons. For a given token, I had made it's min and max being singleton instances. And thus during comparison, for token t1 and t2, if t1.equals(t2), the code was assuming that reference equality was enough to distinguish between the min and max bound. This doesn't work however since there could be more than one Token instance for a given token. The patch fixes that. I'm not sure it was actually possible to get a real bug because of that, but any case, the code was buggy nonetheless.
* To make writting the two new AbstractBound classes easier, I moved the AB.normalize method to Range (since that's the only case we uses it). I also changed a little bit the AB.split method because it wasn't clearly obvious to me how to adapt the current implementation to the new classes.
Note that in the long run it could be cleaner to merge our (now) 4 instances of AB into one class that would have left, right, leftIsInclusive, rightIsInclusive, but that felt like too much work for now.
> Allow rangeSlice queries to be start/end inclusive/exclusive
> -------------------------------------------------------------
>
> Key: CASSANDRA-3749
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
> Project: Cassandra
> Issue Type: Sub-task
> Components: Core
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Fix For: 1.1
>
> Attachments: 3749.patch
>
>
> Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-3749) Allow rangeSlice queries to be
start/end inclusive/exclusive
Posted by "Sylvain Lebresne (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sylvain Lebresne updated CASSANDRA-3749:
----------------------------------------
Attachment: 3749-v2.patch
bq. if we are splitting a Bounds on bounds.right, that means that remainder overlaps Bounds entirely and so we should add that to the ranges, but instead we skip it.
Not absolutely certain about the case you mean, but with an example: let say we have Bounds [3, 5]. And say that one of the token nodes is 5 (so we'll split on bounds.right). So if you split [3, 5] by 5, you're basically not splitting anything, since splitting would end up with [3, 5] and (5, 5], but (5, 5] is an empty range (as it happens, we do use allow creating (5, 5] and it means *all the ring*. That qualifies as weird honestly but that's the way it work. In any case, we shouldn't have split create such a range since it wouldn't be correct). So that's a case of the splitting not changing the input AbstractBounds and thus null is returned. In SP.GRR, when that happens, we simply skip to the next token. If for instance that next token (say 10) isn't contained in [3, 5], we'll just add [3, 5] at the end of the loop.
Attaching v2 that incorporates the comment tweaks, adds tests for SP.GRR for the two new classes and remove the now useless {{if remainder == null}} test at the end of the main loop of SP.GRR.
> Allow rangeSlice queries to be start/end inclusive/exclusive
> -------------------------------------------------------------
>
> Key: CASSANDRA-3749
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3749
> Project: Cassandra
> Issue Type: Sub-task
> Components: Core
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Fix For: 1.1
>
> Attachments: 3749-comments.txt, 3749-v2.patch, 3749.patch
>
>
> Currently, given two keys k1 and k2, we can only do a rangeSlice on the intervals (k1, k2] (Range) and [k1, k2] (Bounds). CQL goes around this "manually", by querying one more row if the start is exclusive and removing the start/end post-query if necessary. This doesn't work however with the new option introduced by CASSANDRA-3742. So this ticket proposes to add support (internally) for doing a rangeSlice for the intervals (k1, k2) an [k1, k2).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira