Don't miss columns TTLs update

This commit is contained in:
alesapin 2020-06-10 21:02:45 +03:00
parent c21fac11cc
commit dd3cf0fe0a

View File

@ -474,8 +474,17 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column
{
StorageInMemoryMetadata new_metadata = getInMemoryMetadata();
if (new_columns != new_metadata.columns)
{
new_metadata.columns = new_columns;
new_metadata.column_ttls_by_name.clear();
for (const auto & [name, ast] : new_metadata.columns.getColumnTTLs())
{
auto new_ttl_entry = TTLDescription::getTTLFromAST(ast, new_metadata.columns, global_context, new_metadata.primary_key);
new_metadata.column_ttls_by_name[name] = new_ttl_entry;
}
}
if (!metadata_diff.empty())
{
if (metadata_diff.sorting_key_changed)