[ 
https://issues.apache.org/jira/browse/CASSANDRA-6778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tyler Hobbs updated CASSANDRA-6778:
-----------------------------------

    Attachment: 6778-test.txt

+1

The attached 6778-text.txt adds a unit test to exercise this patch.

As for 1.2, I agree that this is a pretty rare corner case, so it's probably 
safer to only apply this patch to 2.0.

By the way, it looks like you already did most of this work on 2.1 as part of 
CASSANDRA-5417, so make sure the conflicts get resolved properly.

> FBUtilities.singleton() should use the CF comparator
> ----------------------------------------------------
>
>                 Key: CASSANDRA-6778
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6778
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 2.0.6
>
>         Attachments: 0001-Proper-comparison-for-singleton-sorted-set.txt, 
> 0002-Use-comparator-instead-of-BB.equals.txt, 6778-test.txt
>
>
> We sometimes use FBUtilities.singleton() to created a SortedSet for 
> NamesQueryFilter. However, the set created by that method does not use the CF 
> comparator, so that it use ByteBuffer comparison/equality for methods like 
> contains(). And this might not be ok if it turns that the comparator is so 
> that 2 column name can be equal without their binary representation being 
> equal, and as it turns out at least IntegerType, DecimalType (because they 
> let you put arbitrary many zeros in front of the binary encoding) have such 
> property (BooleanType should also have that property though it doesn't in 
> practice which I think that's a bug, but that's for another ticket).
> I'll note that CASSANDRA-6733 contains an example where this matter.  
> However, in practice, only SELECT on compact tables that select just one 
> column can ever ran into that and you'd only run into it if your client 
> insert useless zeros in its IntegerType/DecimalType binary representation, 
> which ought to be not common in the first place. It's still wrong and should 
> be fixed.
> Patch attached to include the comparator in FBUtilities.singleton. I also 
> found 2 other small places where we were using ByteBuffer.equals() where the 
> comparator should be used instead and attaching a 2nd patch for those.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to