Open cvybhu opened 2 years ago
Hmm, that's a tough pickle. I'm not sure this can be fixed without changes to the protocol/database. The issue with changing types of columns sounds prone to a race like in the prepared SELECT *
fiasco (https://docs.datastax.com/en/developer/java-driver/3.0/manual/statements/prepared/#avoid-preparing-select-queries), i.e. another client may quickly re-prepare the statement and our current client will not even notice that it needs to update the metadata.
I think there are some fixes for the problem in protocol version 5, although I'm not familiar with them and ScyllaDB doesn't implement V5 (apart from the duration
datatype, AFAIK).
The problem has been described in #986. Let's consider closing this. @Lorak-mmk @muzarski
The problem is described, but not fixed.
A
PreparedStatement
sometimes has to be prepared again. This happens when its removed from the cache, or the schema changes.PreparedStatement
containsPreparedMetadata
, which keeps types of values bound to the query. After a schema change this field should be updated during repreparation. For now this doesn't cause any issues, but in the future we might add more validation to the bound values (#463) and some problems may arise.Here's an example, which creates a user type, prepares a statement and adds a new field to the user type. The
PreparedStatement
still thinks that there's only one field in the user type.Output: