Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-7089

Some problems with typed ByteBuffer comparisons?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.1 beta2
    • None
    • None
    • Low

    Description

      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.

      Attachments

        1. 0002-Don-t-compare-components-with-equals.txt
          6 kB
          Sylvain Lebresne
        2. 0001-Remove-ColumnIdentifier.compareTo.txt
          2 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            benedict Benedict Elliott Smith
            Sylvain Lebresne
            Benedict Elliott Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: