Cassandra
  1. Cassandra
  2. CASSANDRA-5172

Detect (and warn) unintentional use of the cql2 thrift methods when cql3 was the intention

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 1.2.1
    • Component/s: None
    • Labels:
      None

      Description

      In 1.2.0 we've separated the thrift methods for CQL2 and CQL3 (due to CASSANDRA-4734). In doing so, we've made set_cql_version a silent no-op.

      However it means that the 1.1 way of querying CQL3 now silently end up calling CQL2 in 1.2.0. So I suggest that if someone calls set_cql_version, we record the version set and warn if (throw an invalid exception) if someone asks for CQL3 but later use the CQL2 methods.

      1. 5172.txt
        2 kB
        Sylvain Lebresne
      2. 5172-2.txt
        6 kB
        Sylvain Lebresne

        Issue Links

          Activity

          Sylvain Lebresne created issue -
          Hide
          Sylvain Lebresne added a comment -

          In fact I think we can just have set_cql_version complain if a client asks for CQL3. Indeed, a client that does so is a client that has not been upgraded to use the new thrift CQL3 methods and such client is guaranteed to not work correctly. So no point in letting him continue thinking everything is fine.

          Patch attached to do that.

          Show
          Sylvain Lebresne added a comment - In fact I think we can just have set_cql_version complain if a client asks for CQL3. Indeed, a client that does so is a client that has not been upgraded to use the new thrift CQL3 methods and such client is guaranteed to not work correctly. So no point in letting him continue thinking everything is fine. Patch attached to do that.
          Sylvain Lebresne made changes -
          Field Original Value New Value
          Attachment 5172.txt [ 12565484 ]
          Hide
          Jonathan Ellis added a comment -

          +1

          Show
          Jonathan Ellis added a comment - +1
          Sylvain Lebresne made changes -
          Link This issue is duplicated by CASSANDRA-5177 [ CASSANDRA-5177 ]
          Hide
          Sylvain Lebresne added a comment -

          Since I forgot to close this issue, I think we can do a little bit better in fact. The "default" of version 1 (that was committed, so v2 in on top of v1) is that if a CQL3 client was updated to Cassandra 1.2.0 but without removing the call to set_cql_version (which wouldn't be surprising since we said nowhere it should be removed), then this client will have to be changed again with the v1 of this ticket (for no good reason). Besides, making the call to set_cql_version invalid is not particularly intuitive.

          So v2 is a bit more permissive and let people call set_cql_version or not, but if they call it (which old, non-upgraded CQL3 client will do), then we warn if a CQL2 method is called.

          Show
          Sylvain Lebresne added a comment - Since I forgot to close this issue, I think we can do a little bit better in fact. The "default" of version 1 (that was committed, so v2 in on top of v1) is that if a CQL3 client was updated to Cassandra 1.2.0 but without removing the call to set_cql_version (which wouldn't be surprising since we said nowhere it should be removed), then this client will have to be changed again with the v1 of this ticket (for no good reason). Besides, making the call to set_cql_version invalid is not particularly intuitive. So v2 is a bit more permissive and let people call set_cql_version or not, but if they call it (which old, non-upgraded CQL3 client will do), then we warn if a CQL2 method is called.
          Sylvain Lebresne made changes -
          Attachment 5172-2.txt [ 12565797 ]
          Sylvain Lebresne made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Reviewer jbellis
          Hide
          Aleksey Yeschenko added a comment -

          +1

          Show
          Aleksey Yeschenko added a comment - +1
          Hide
          Sylvain Lebresne added a comment -

          Alright, committed, thanks

          Show
          Sylvain Lebresne added a comment - Alright, committed, thanks
          Sylvain Lebresne made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Gavin made changes -
          Workflow no-reopen-closed, patch-avail [ 12746630 ] patch-available, re-open possible [ 12753824 ]
          Gavin made changes -
          Workflow patch-available, re-open possible [ 12753824 ] reopen-resolved, no closed status, patch-avail, testing [ 12759007 ]
          Hide
          zach evans added a comment -

          Can someone please let me know how I update my Cassandra with this patch. I have no clue and I can't find out how. PLEASE HELP.

          Show
          zach evans added a comment - Can someone please let me know how I update my Cassandra with this patch. I have no clue and I can't find out how. PLEASE HELP.
          Hide
          Aleksey Yeschenko added a comment -

          Can someone please let me know how I update my Cassandra with this patch. I have no clue and I can't find out how. PLEASE HELP.

          It's in 1.2.1 already. Just upgrade to 1.2.1 and you should be good.

          Show
          Aleksey Yeschenko added a comment - Can someone please let me know how I update my Cassandra with this patch. I have no clue and I can't find out how. PLEASE HELP. It's in 1.2.1 already. Just upgrade to 1.2.1 and you should be good.
          Hide
          zach evans added a comment - - edited

          I am using 1.2.1... This is when using Astyanax with cassandra 1.2.1. The astyanax version is 1.56.21...

          I receive this error message...

          com.netflix.astyanax.connectionpool.exceptions.BadRequestException: BadRequestException: [host=127.0.0.1(127.0.0.1):9160, latency=21(50), attempts=1]InvalidRequestException(why:Cannot execute/prepare CQL2 statement since the CQL has been set to CQL3(This might mean your client hasn't been upgraded correctly to use the new CQL3 methods introduced in Cassandra 1.2+).)

          Show
          zach evans added a comment - - edited I am using 1.2.1... This is when using Astyanax with cassandra 1.2.1. The astyanax version is 1.56.21... I receive this error message... com.netflix.astyanax.connectionpool.exceptions.BadRequestException: BadRequestException: [host=127.0.0.1(127.0.0.1):9160, latency=21(50), attempts=1] InvalidRequestException(why:Cannot execute/prepare CQL2 statement since the CQL has been set to CQL3(This might mean your client hasn't been upgraded correctly to use the new CQL3 methods introduced in Cassandra 1.2+).)
          Hide
          Aleksey Yeschenko added a comment -

          Looks like Astyanax is setting cql version to 3.0.0, yet is using execute_cql_query instead of execute_cql3_query method. Is astyanax 1.56.21 the most recent version? Try updating it, maybe?

          Show
          Aleksey Yeschenko added a comment - Looks like Astyanax is setting cql version to 3.0.0, yet is using execute_cql_query instead of execute_cql3_query method. Is astyanax 1.56.21 the most recent version? Try updating it, maybe?

            People

            • Assignee:
              Sylvain Lebresne
              Reporter:
              Sylvain Lebresne
              Reviewer:
              Jonathan Ellis
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development