cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian O'Neill <b...@alumni.brown.edu>
Subject Re: Wrap around CQL queries for token ranges?
Date Mon, 11 May 2015 17:05:29 GMT
Looks like the java-driver supplies the hack I need.  (TokenRange.unwrap)

I¹ll leave it to you guys to decide if it is more elegant to support
wrapping natively in CQL.

-brian

---
Brian O'Neill 
Chief Technology Officer
Health Market Science, a LexisNexis Company
215.588.6024 Mobile € @boneill42 <http://www.twitter.com/boneill42>


This information transmitted in this email message is for the intended
recipient only and may contain confidential and/or privileged material. If
you received this email in error and are not the intended recipient, or the
person responsible to deliver it to the intended recipient, please contact
the sender at the email above and delete this email and any attachments and
destroy any copies thereof. Any review, retransmission, dissemination,
copying or other use of, or taking any action in reliance upon, this
information by persons or entities other than the intended recipient is
strictly prohibited.
 


From:  Brian O'Neill <bone@alumni.brown.edu>
Date:  Monday, May 11, 2015 at 12:32 PM
To:  "dev@cassandra.apache.org" <dev@cassandra.apache.org>
Subject:  Wrap around CQL queries for token ranges?


I was doing some testing around data locality today (and adding it to our
distributed processing layer).
I retrieved all of the TokenRanges back using:
tokenRanges = metadata.getTokenRanges(keyspace, localhost)


And when I spun through the token ranges returned, I ended up missing
records.  
The root cause was the ³edge case² where the ring wraps around.

It generated the following CQL query: (using the last token range)

cqlsh> SELECT token(id),id,name FROM test_keyspace.test_table WHERE
token(id)>8743874685407455894 AND token(id)<=-8851282698028303387;

(0 rows)

cqlsh> SELECT token(id),id,name FROM test_keyspace.test_table WHERE
token(id)<=-8851282698028303387 AND token(id)>-9223372036854775808;

 token(id)            | id | name
----------------------+----+--------
 -9157060164899361011 | 23 | name23
 -9108684050423740263 | 53 | name53
 -9084883821289052775 | 91 | name91
(3 rows)

NOTE: If I use Long.MAX_VALUE instead, I get the records.

I can hack this at the app layer, to issue separate queries for the wrap
around case, but I wonder if CQL should support wrap around queries???

-brian

---
Brian O'Neill 
Chief Technology Officer
Health Market Science, a LexisNexis Company
215.588.6024 Mobile € @boneill42 <http://www.twitter.com/boneill42>


This information transmitted in this email message is for the intended
recipient only and may contain confidential and/or privileged material. If
you received this email in error and are not the intended recipient, or the
person responsible to deliver it to the intended recipient, please contact
the sender at the email above and delete this email and any attachments and
destroy any copies thereof. Any review, retransmission, dissemination,
copying or other use of, or taking any action in reliance upon, this
information by persons or entities other than the intended recipient is
strictly prohibited.
 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message