You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sandeep Tamhankar (JIRA)" <ji...@apache.org> on 2016/08/30 21:21:21 UTC

[jira] [Commented] (CASSANDRA-10145) Change protocol to allow sending key space independent of query string

    [ https://issues.apache.org/jira/browse/CASSANDRA-10145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15450188#comment-15450188 ] 

Sandeep Tamhankar commented on CASSANDRA-10145:
-----------------------------------------------

I agree with you about prepared statement, but it's not the true that the drivers use string replacement for query parameters in non-prepared statements. Looking at the Ruby driver, it sets some flags in the request and then dumps the params...as of v2 protocol. So there is precedent for separation of church and state. ;)

String replacement is not practical in the drivers because there are *seven* drivers and each would need to implement a cql parser in their language, then push the keyspace name into the parsed data structure, and then serialize back to a cql string.

My proposal in the dup'ed issue sounds fairly simple - the client sends the keyspace in custom payload. We just have to figure out how to manage prepared statements. I don't know the mechanics underlying it, but my gut feeling is that when you send a prepare request you could send the keyspace (just like regular CQL), and the prepared result can be tagged with the keyspace name. Then when bound statements are sent to C*, we send the keyspace just like any other request.

Just looked at the v4 protocol and it seems workable. Looking deeper at the Ruby driver code, it looks like when we're ready to execute a statement (of any kind), we do a round trip to C*, issuing a USE request, before sending the real request if the connection's keyspace is different from the statement's keyspace. So, if we didn't have this binding, we could eliminate a round trip to C*!

Can we reconsider this? Maybe it makes sense to continue the discussion in the new ticket, which has the full proposal.

> Change protocol to allow sending key space independent of query string
> ----------------------------------------------------------------------
>
>                 Key: CASSANDRA-10145
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10145
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Vishy Kasar
>
> Currently keyspace is either embedded in the query string or set through "use keyspace" on a connection by client driver. 
> There are practical use cases where client user has query and keyspace independently. In order for that scenario to work, they will have to create one client session per keyspace or have to resort to some string replace hackery.
> It will be nice if protocol allowed sending keyspace separately from the query. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)