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

Expose API to load prepare statement based on preparedId

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Invalid
    • Fix Version/s: 2.1.6
    • Component/s: None
    • Labels:
      None
    • Environment:

      Cassandra 2.0.16
      Java driver 2.1.6
      Ubuntu 15.04

    • Severity:
      Normal

      Description

      Currently whenever client calls session.prepare(Statement), the Java driver prepares the statement with cassandra. Cassandra prepares the statement, caches in memory and returns prepareId. The driver caches it in the session and uses it subsequently.

      In case, we have another session (as in web application or REST services, there are multiple JVM and so different cluster and session instances), currently we need reprepare the same query for which we need the original query string and other details (like consistency level and so on).

      Since cassandra is already caching in memory (also a ticket is there to persist as well in 3.x), we can have an API to load the preparestatement from any session (if not there in the cache already) as below

      Session.loadPreparedStatement(MD5Digest id)

      where the driver can call Cassandra and load the preparedstatement (to get metadata, resultSetMetadata, routingKeyIndexes etc...).

      WIth this, the client need to cache only the prepareId and can avoid multiple round trip to prepare the query (same query) again with different hosts.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ajaygarga Ajay
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: