Cassandra
  1. Cassandra
  2. CASSANDRA-5349

Add binary protocol support for bind variables to non-prepared statements

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 2.0 beta 1
    • Component/s: API
    • Labels:

      Description

      Currently, the binary protocol allows requests as "string" or "[prepared statement] id + bind vars". Allowing "string + bind vars" as well would simplify life for users with one-off statements and not have to choose between adding boilerplate for PS, and having to manually escape parameters, which is particularly painful for binary data.

      1. 0001-CASSANDRA-5349-binary-protocol-support-for-binding-v.patch
        24 kB
        Marcus Eriksson
      2. 0001-CASSANDRA-5349.patch
        7 kB
        Marcus Eriksson
      3. 0001-5349-v3.patch
        7 kB
        Marcus Eriksson

        Issue Links

          Activity

          Hide
          Marcus Eriksson added a comment -

          adds bind variables to non-prepared statements

          also adds rudimentary protocol/message-versioning, this is backwards compatible but im creating a new ticket to do this properly (ie connecting with new clients to old servers is currently not possible for example)

          Show
          Marcus Eriksson added a comment - adds bind variables to non-prepared statements also adds rudimentary protocol/message-versioning, this is backwards compatible but im creating a new ticket to do this properly (ie connecting with new clients to old servers is currently not possible for example)
          Hide
          Sylvain Lebresne added a comment -

          Alright, would you mind rebasing once you've committed CASSANDRA-5436? And if you could include the update of the specification doc that would be great, I'd rather keep the spec up to date at all time or things will fall through the cracks.

          Show
          Sylvain Lebresne added a comment - Alright, would you mind rebasing once you've committed CASSANDRA-5436 ? And if you could include the update of the specification doc that would be great, I'd rather keep the spec up to date at all time or things will fall through the cracks.
          Hide
          Marcus Eriksson added a comment -

          rebased and updated spec doc

          Show
          Marcus Eriksson added a comment - rebased and updated spec doc
          Hide
          Sylvain Lebresne added a comment -

          Wonder if it wouldn't be worth to put the new values at the end of the message, after the consistency level? That way, we could make that last part optional (i.e. the server would check whether there is remaining bytes to read after the CL). The 2 small advantages would be that 1) if you don't have bind variables, we could save the short encoding the number of values and 2) would made it marginally easier on the client if they want to support both v1 and v2 (as in the case of no binding variables, they don't have to bother about which version is in use). Not huge pros, but if there is no cons...

          Nit:

          • we can have the old QP.process() call the new one with an empty list.
          Show
          Sylvain Lebresne added a comment - Wonder if it wouldn't be worth to put the new values at the end of the message, after the consistency level? That way, we could make that last part optional (i.e. the server would check whether there is remaining bytes to read after the CL). The 2 small advantages would be that 1) if you don't have bind variables, we could save the short encoding the number of values and 2) would made it marginally easier on the client if they want to support both v1 and v2 (as in the case of no binding variables, they don't have to bother about which version is in use). Not huge pros, but if there is no cons... Nit: we can have the old QP.process() call the new one with an empty list.
          Hide
          Marcus Eriksson added a comment -

          v3 adds the value count and values last

          also calls process() with empty list

          Show
          Marcus Eriksson added a comment - v3 adds the value count and values last also calls process() with empty list
          Hide
          Sylvain Lebresne added a comment -

          lgtm, +1

          Show
          Sylvain Lebresne added a comment - lgtm, +1
          Hide
          Marcus Eriksson added a comment -

          committed as df723af8a6c04536abd2b4a48cd101f3b2e96746, thanks

          Show
          Marcus Eriksson added a comment - committed as df723af8a6c04536abd2b4a48cd101f3b2e96746, thanks

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development