Open piodul opened 1 year ago
If we decided that it shouldn't be part of 0.12.0, please comment and describe the decision and dependency and change the Milestone.
We discussed it offline with @muzarski and decided to go with the last option on the "Handling the MissingUserDefinedType case". It introduces a dependency on https://github.com/scylladb/scylla-rust-driver/issues/595, which is currently being worked on and targets 0.13.0, so I'll move this one to 0.13.0, too.
Currently, the driver has two complex but similar types:
ColumnType
andCqlType
. They are both supposed to represent a CQL type, but have slight differences:ColumnType
is used in metadata of prepared statements and responses to queries. It does not include information about whether collections and UDTs are frozen. The type definitions are self contained - if it represents a complex type that contains a UDT somewhere inside it, it has the whole definition of the UDT inline.CqlType
is used in ClusterMetadata - it is computed based on the information in the system tables. It does include information about whether collections and UDTs are frozen. Until recently (changed in https://github.com/scylladb/scylla-rust-driver/pull/649) information about UDTs was not inlined, but now it is; however, if metadata fetch returns inconsistent metadata and it does not have a definition of a UDT that was needed inside someCqlType
, then a placeholderMissingUserDefinedType
will be put instead.Those types have very similar names and function, so it might make sense to unify them. This will help write user logic that is supposed to operate on both representations. We will have to account for the differences:
()
vs.bool
, or two new enums isomorphic to those types that express the intent better.MissingUserDefinedType
case:Result<_, MissingUserDefinedType>
in the unified type. However, this would force the users that need to operate on the existingColumnType
representation to handle theResult
, even though it would never be an error, so that would introduce unnecessary complication and would be ugly.MissingUserDefinedType
into a generic parameter, like in the case of the "frozen flag" - in case ofColumnType
it would be an uninhabited type. Slightly better, but theResult
is still there.MissingUserDefinedType
altogether! I insisted on handling theMissingUserDefinedType
error like this to make the driver more robust; if we didn't have it then we would have to fail the whole metadata fetch and probably fail the creation ofSession
. However, if we move the cluster metadata module out of the driver like described in https://github.com/scylladb/scylla-rust-driver/issues/595, then it should be fine to fail the whole metadata fetch as it won't reduce availability. Therefore #595 is a requirement for this solution.