mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 09:30:45 +00:00
Some legacy `mc` SSTables (created in Scylla 3.0) may contain incorrect serialization headers, which don't wrap frozen UDTs nested inside collections with the FrozenType<...> tag. When reading such SSTable, Scylla would detect a mismatch between the schema saved in schema tables (which correctly wraps UDTs in the FrozenType<...> tag) and the schema from the serialization header (which doesn't have these tags). SSTables created in Scylla versions 3.1 and above, in particular in Scylla versions that contain this commit, create correct serialization headers (which wrap UDTs in the FrozenType<...> tag). This commit does two things: 1. for all SSTables created after this commit, include a new feature flag, CorrectUDTsInCollections, presence of which implies that frozen UDTs inside collections have the FrozenType<...> tag. 2. when reading a Scylla SSTable without the feature flag, we assume that UDTs nested inside collections are always frozen, even if they don't have the tag. This assumption is safe to be made, because at the time of this commit, Scylla does not allow non-frozen (multi-cell) types inside collections or UDTs, and because of point 1 above. There is one edge case not covered: if we don't know whether the SSTable comes from Scylla or from C*. In that case we won't make the assumption described in 2. Therefore, if we get a mismatch between schema and serialization headers of a table which we couldn't confirm to come from Scylla, we will still reject the table. If any user encounters such an issue (unlikely), we will have to use another solution, e.g. using a separate tool to rewrite the SSTable. Fixes #6130.