We're updating the issue view to help you get more done. 

Fail fast if the prepared id doesn't match when we reprepare on the fly

Description

There are cases where the driver might go into an infinite reprepare loop if a statement gets prepared, the session is switched to a different keyspace, the statement gets invalidated from the server cache, and the driver tries to reprepare on the fly: see CASSANDRA-15252.

We could at least fail fast in CqlRequestHandler.processErrorResponse to avoid the loop: compare the id returned in the PREPARED response (we'll have to modify AdminRequestHandler because currently it provides no way to retrieve it) to the original one (we can get it from the initial UNPREPARED response). Then fail the request with an error in the line of "don't do USE queries with prepared statements"...

Environment

None

Pull Requests

None

Status

Assignee

Olivier Michallat

Reporter

Olivier Michallat

Labels

None

PM Priority

None

Reproduced in

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Fix versions

Priority

Minor