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 (JIRA)" <ji...@apache.org> on 2014/04/25 11:17:18 UTC

[jira] [Updated] (CASSANDRA-7089) Some problems with typed ByteBuffer comparisons?

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

Sylvain Lebresne updated CASSANDRA-7089:
----------------------------------------

    Attachment: 0002-Don-t-compare-components-with-equals.txt
                0001-Remove-ColumnIdentifier.compareTo.txt

Attaching patch to fix both. ColumnIdentifier.cmopareTo is also in 1.2 and 2.0, but it's unused there, so I'll just remove it on commit (isPrefixOf is 2.1 only however).


> Some problems with typed ByteBuffer comparisons?
> ------------------------------------------------
>
>                 Key: CASSANDRA-7089
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7089
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Benedict
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.1 beta2
>
>         Attachments: 0001-Remove-ColumnIdentifier.compareTo.txt, 0002-Don-t-compare-components-with-equals.txt
>
>
> ColumnIdentifier.compareTo() appears subtly broken: it looks to me that we should be using ByteBufferUtil.compareUnsigned() instead of bytes.compareTo(), since they are meant to be UTF8Type. I think it would be nice to drop this compareTo method entirely, as it's only used by CFMetaData.regularColumnComparator and it seems possible to misuse accidentally at a later date since it only works for CQL columns, but a ColumnIdentifier is used for thrift columns as well.
> There's a related problem with CellName.isPrefixOf, where we are using equals() instead of type.compareTo() == 0, which could break anyone misusing our old friend Boolean as a clustering column.



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