-
Notifications
You must be signed in to change notification settings - Fork 11
Description
If a new CQL host was added to the driver (including the host just down & up) - the drivers resends all Prepared statement to the host for the session context restoring.
If the Prepared Query is stored with 'keyspace', the driver sends 'USE ' (in a special temporary connection) before the PREPARE CQL request.
The 'USE' query is needed if the statement uses short non-qualified table names.
But if the prepared statement uses fully qualified table names the additional 'USE ' query is useless. And only affects the time of the new connection establishing, which can affect the system startup time if we have many new connections at the same time.
The issue fix must prevent these not needed 'USE ' queries from the driver.
Implementation notes:
ResultResponse as result of Prepare request has metadata including table name & keyspace related to the prepared statement.
The keyspace is stored in Session together with prepared_id & prepared_query. The keyspace should be cleaned or ignored when the prepared statement uses only fully qualified table names to prevent the discussed 'USE ' queries when a new host is added.
For non-qualified table names in prepared statement the 'USE' query makes sense and the driver behavior should still unchanged.