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

Fix range scans for table with live static rows

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.0.9, 3.8
    • Legacy/CQL
    • None
    • Normal

    Description

      We were seeing some weird behaviour with limit based scan queries. In particular, we see the following:

      $ cqlsh -k sd -e "consistency local_quorum; SELECT uuid, token(uuid) FROM files WHERE token(uuid) >= token('6b470c3e43ee06d1') limit 2"
      Consistency level set to LOCAL_QUORUM.
      
       uuid             | system.token(uuid)
      ------------------+----------------------
       6b470c3e43ee06d1 | -9218823070349964862
       484b091ca97803cd | -8954822859271125729
      
      (2 rows)
      $ cqlsh -k sd -e "consistency local_quorum; SELECT uuid, token(uuid) FROM files WHERE token(uuid) > token('6b470c3e43ee06d1') limit 1"
      Consistency level set to LOCAL_QUORUM.
      
       uuid             | system.token(uuid)
      ------------------+----------------------
       c348aaec2f1e4b85 | -9218781105444826588
      

      In the table uuid is partition key, and it has a clustering key as well.
      So the uuid "c348aaec2f1e4b85" should be the second one in the limit query. After some investigation, it seems to me like the issue is in the way DataLimits handles static rows. Here is a patch for trunk (https://github.com/sharvanath/cassandra/commit/9a460d40e55bd7e3604d987ed4df5c8c2e03ffdc) which seems to fix it for me. Please take a look, seems like a pretty critical issue to me.

      I have forked the dtests for it as well. However, since trunk has some failures already, I'm not fully sure how to infer the results.
      http://cassci.datastax.com/view/Dev/view/sharvanath/job/sharvanath-fixScan-dtest/
      http://cassci.datastax.com/view/Dev/view/sharvanath/job/sharvanath-fixScan-testall/

      Attachments

        1. repro
          3 kB
          Sharvanath Pathak
        2. 12107-3.0.txt
          3 kB
          Benjamin Lerer

        Activity

          blerer Benjamin Lerer added a comment -

          sharvanath, could you provide the table schema and the rows with uuid: 6b470c3e43ee06d1, 484b091ca97803cd, c348aaec2f1e4b85 or a simple unit test to help us reproduce the problem.
          Your patch might be valid but it is difficult to say without a way to reproduce the problem.

          blerer Benjamin Lerer added a comment - sharvanath , could you provide the table schema and the rows with uuid: 6b470c3e43ee06d1, 484b091ca97803cd, c348aaec2f1e4b85 or a simple unit test to help us reproduce the problem. Your patch might be valid but it is difficult to say without a way to reproduce the problem.

          blerer I have attached a text file which describes a way to reproduce the bug locally. Thanks for looking into this.

          sharvanath Sharvanath Pathak added a comment - blerer I have attached a text file which describes a way to reproduce the bug locally. Thanks for looking into this.
          blerer Benjamin Lerer added a comment -

          Thanks for the scenario to reproduce the problem and the patch.
          The patch looks good to me. I have just added a unit test to it.

          utests dtests
          3.0 3.0
          3.9 3.9

          The failing tests do not look related to the change.

          blerer Benjamin Lerer added a comment - Thanks for the scenario to reproduce the problem and the patch. The patch looks good to me. I have just added a unit test to it. utests dtests 3.0 3.0 3.9 3.9 The failing tests do not look related to the change.
          blerer Benjamin Lerer added a comment -

          Committed into 3.0 at 84426d183ae095107bb264b92d828f231d0a9826 and merged into 3.9 and trunk.

          blerer Benjamin Lerer added a comment - Committed into 3.0 at 84426d183ae095107bb264b92d828f231d0a9826 and merged into 3.9 and trunk.
          sharvanath Sharvanath Pathak added a comment - - edited

          Thanks blerer

          sharvanath Sharvanath Pathak added a comment - - edited Thanks blerer

          People

            sharvanath Sharvanath Pathak
            sharvanath Sharvanath Pathak
            Sharvanath Pathak
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: