If a keyspaced id dropped and C* rebooted, the driver may hang
Running this script, and rebooting C* in the while loop, we get the error:
ConnectionException: Problem while setting keyspace: InvalidRequest('Error from server: code=2200 [Invalid query] message="Keyspace \'testkeyspace\' does not exist"',)
This is because when the reconnection is made the driver tries to set the keyspace for the connection, despite maybe having been deleted long time ago, but it fails to do because it doesn't exit.
I think our earlier assessment was right – the case we're concerned about here is extremely narrow and not worth the complexity of the fix.
I just want to make a note on this while I'm thinking about it:
Attempting to reconnect to a particular keyspace is important. I believe that if we create a keyspace, but don't wait for schema consistency, then attempt to connect or reconnect with a keyspace set, we should reattempt until the connection works, or until some timeout.
The behavior we want to fix here, I think, is the hang. Reconnecting without setting a keyspace is, I think, not an option.