better checking if table has TTL

This commit is contained in:
CurtizJ 2020-01-27 14:53:50 +03:00
parent 14f0b9e137
commit a5d9975e37
3 changed files with 5 additions and 5 deletions

View File

@ -3914,8 +3914,8 @@ Names MergeTreeData::getColumnsRequiredForTTL() const
res.insert(columns_vec.begin(), columns_vec.end());
};
if (hasTableTTL())
add_columns_to_set(ttl_table_entry.expression);
if (hasRowsTTL())
add_columns_to_set(rows_ttl_entry.expression);
for (const auto & [_, entry] : column_ttl_entries_by_name)
add_columns_to_set(entry.expression);
@ -3928,7 +3928,7 @@ Names MergeTreeData::getColumnsRequiredForTTL() const
Names MergeTreeData::getColumnsUpdatedByTTL() const
{
if (hasTableTTL())
if (hasRowsTTL())
return getColumns().getAllPhysical().getNames();
Names res;

View File

@ -652,7 +652,7 @@ bool StorageMergeTree::merge(
{
/// Force filter by TTL in 'OPTIMIZE ... FINAL' query to remove expired values from old parts
/// without TTL infos or with outdated TTL infos, e.g. after 'ALTER ... MODIFY TTL' query.
bool force_ttl = (final && (hasRowsTTL() || hasAnyColumnTTL()));
bool force_ttl = (final && hasAnyTTL());
new_part = merger_mutator.mergePartsToTemporaryPart(
future_part, *merge_entry, table_lock_holder, time(nullptr),

View File

@ -3133,7 +3133,7 @@ bool StorageReplicatedMergeTree::optimize(const ASTPtr & query, const ASTPtr & p
return false;
};
bool force_ttl = (final && (hasRowsTTL() || hasAnyColumnTTL()));
bool force_ttl = (final && hasAnyTTL());
const auto storage_settings_ptr = getSettings();
if (!partition && final)