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

Wrong assumption for KeyRange about range.end_token in get_range_slices().

    XMLWordPrintableJSON

Details

    • Low

    Description

      In get_range_slices() there is parameter KeyRange range.

      There you can pass start_key - end_key, start_token - end_token, or start_key - end_token.

      This is described in the documentation.

      in thrift/ThriftValidation.java there is validation function validateKeyRange() (line:489) that validates correctly the KeyRange, including the case start_key - end_token.

      However in thrift/CassandraServer.java in function get_range_slices() on line: 686 wrong assumption is made:

      if (range.start_key == null)

      { ... // populate tokens }

      else

      { bounds = new Bounds<RowPosition>(RowPosition.forKey(range.start_key, p), RowPosition.forKey(range.end_key, p)); }

      This means if there is start key, no end token is checked.
      The opposite - null is "inserted" as end_key.

      Solution:
      same file - thrift/CassandraServer.java on next function - get_paged_slice(), on line:741 same code is written correctly

      if (range.start_key == null)

      { ... // populate tokens }

      else

      { RowPosition end = range.end_key == null ? p.getTokenFactory().fromString(range.end_token).maxKeyBound(p) : RowPosition.forKey(range.end_key, p); bounds = new Bounds<RowPosition>(RowPosition.forKey(range.start_key, p), end); }

      Attachments

        1. cassa.1.2.x.diff.txt
          1.0 kB
          Nikolay
        2. cassa.1.1.6.diff.txt
          1.0 kB
          Nikolay

        Activity

          People

            nmmm Nikolay
            nmmm Nikolay
            Nikolay
            David Brosius
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified