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

ShortType and ByteType are incorrectly considered variable-length types

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Legacy/Core
    • Labels:
    • Severity:
      Low
    • Complexity:
      Low Hanging Fruit
    • Since Version:

      Description

      The AbstractType class has a method valueLengthIfFixed() that returns -1 for data types with a variable length and a positive value for types with a fixed length. This is primarily used for efficient serialization and deserialization. 

       

      It turns out that there is an inconsistency in types ShortType and ByteType as those are in fact fixed-length types (2 bytes and 1 byte, respectively) but they don't have the valueLengthIfFixed() method overloaded and it returns -1 as if they were of variable length.

       

      It would be good to fix that at some appropriate point, for example, when introducing a new version of SSTables format, to keep the meaning of the function consistent across data types. Saving some bytes in serialized format is a minor but pleasant bonus.

        Attachments

          Activity

            People

            • Assignee:
              jearvon_dharrie Jearvon Dharrie
              Reporter:
              argenet Vladimir Krivopalov
              Authors:
              Jearvon Dharrie
              Reviewers:
              Ariel Weisberg
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: