schema tables: Remove mutations to unknown tables when adapting schema
mutations Whenever an alter table occurs, the mutations for the just altered table are sent over to all of the replicas from the coordinator. In a mixed cluster the mutations should be adapted to a specific version of the schema. However, the adaptation that happens today doesn't omit mutations to newly added schema tables, to be more specific, mutations to the `computed_columns` table which doesn't exist for example in version 2019.1 This makes altering a table during a rolling upgrade from 2019.1 to 2020.1 dangerous.
This commit is contained in:
@@ -783,6 +783,13 @@ future<std::vector<canonical_mutation>> convert_schema_to_mutations(distributed<
|
||||
|
||||
std::vector<mutation>
|
||||
adjust_schema_for_schema_features(std::vector<mutation> schema, schema_features features) {
|
||||
//Don't send the `computed_columns` table mutations to nodes that doesn't know it.
|
||||
if (!features.contains(schema_feature::COMPUTED_COLUMNS)) {
|
||||
schema.erase(std::remove_if(schema.begin(), schema.end(), [] (const mutation& m) {
|
||||
return m.schema()->cf_name() == COMPUTED_COLUMNS;
|
||||
}) , schema.end());
|
||||
}
|
||||
|
||||
for (auto& m : schema) {
|
||||
m = redact_columns_for_missing_features(m, features);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user