cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandeep Tamhankar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10145) Change protocol to allow sending key space independent of query string
Date Tue, 30 Aug 2016 21:21:21 GMT

    [ 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)

Mime
View raw message