mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
Placed move TTL rules to a vector.
This commit is contained in:
parent
ae4b2b4ace
commit
7407f7c39d
@ -205,9 +205,9 @@ void TTLBlockInputStream::removeValuesWithExpiredColumnTTL(Block & block)
|
||||
void TTLBlockInputStream::updateMovesTTL(Block & block)
|
||||
{
|
||||
std::vector<String> columns_to_remove;
|
||||
for (const auto & [name, ttl_entry] : storage.move_ttl_entries_by_name)
|
||||
for (const auto & ttl_entry : storage.move_ttl_entries)
|
||||
{
|
||||
auto & new_ttl_info = new_ttl_infos.moves_ttl[name];
|
||||
auto & new_ttl_info = new_ttl_infos.moves_ttl[ttl_entry.result_column];
|
||||
|
||||
if (!block.has(ttl_entry.result_column))
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ void ASTTTLElement::formatImpl(const FormatSettings & settings, FormatState & st
|
||||
}
|
||||
else if (destination_type == PartDestinationType::DELETE)
|
||||
{
|
||||
/// It would be better to output "DELETE" here but that will break compatibility with earlier versions.
|
||||
/// It would be better to output "DELETE" here but that will break compatibility with earlier versions.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ void MergeTreeData::setTTLExpressions(const ColumnsDescription::ColumnTTLs & new
|
||||
{
|
||||
new_ttl_entry.destination_type = ttl_element.destination_type;
|
||||
new_ttl_entry.destination_name = ttl_element.destination_name;
|
||||
move_ttl_entries_by_name.emplace(new_ttl_entry.result_column, new_ttl_entry);
|
||||
move_ttl_entries.emplace_back(std::move(new_ttl_entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3729,9 +3729,9 @@ const MergeTreeData::TTLEntry * MergeTreeData::selectMoveDestination(
|
||||
/// Prefer TTL rule which went into action last.
|
||||
time_t max_min_ttl = 0;
|
||||
|
||||
for (const auto & [name, ttl_entry] : move_ttl_entries_by_name)
|
||||
for (const auto & ttl_entry : move_ttl_entries)
|
||||
{
|
||||
auto ttl_info_it = ttl_infos.moves_ttl.find(name);
|
||||
auto ttl_info_it = ttl_infos.moves_ttl.find(ttl_entry.result_column);
|
||||
if (ttl_info_it != ttl_infos.moves_ttl.end()
|
||||
&& ttl_info_it->second.min >= minimum_time
|
||||
&& max_min_ttl <= ttl_info_it->second.min)
|
||||
|
@ -737,7 +737,7 @@ public:
|
||||
TTLEntriesByName column_ttl_entries_by_name;
|
||||
|
||||
TTLEntry ttl_table_entry;
|
||||
TTLEntriesByName move_ttl_entries_by_name;
|
||||
std::vector<TTLEntry> move_ttl_entries;
|
||||
|
||||
String sampling_expr_column_name;
|
||||
Names columns_required_for_sampling;
|
||||
|
@ -226,8 +226,8 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataWriter::writeTempPart(BlockWithPa
|
||||
size_t expected_size = block.bytes();
|
||||
|
||||
DB::MergeTreeDataPart::TTLInfos move_ttl_infos;
|
||||
for (const auto & [name, ttl_entry] : data.move_ttl_entries_by_name)
|
||||
updateTTL(ttl_entry, move_ttl_infos, move_ttl_infos.moves_ttl[name], block);
|
||||
for (const auto & ttl_entry : data.move_ttl_entries)
|
||||
updateTTL(ttl_entry, move_ttl_infos, move_ttl_infos.moves_ttl[ttl_entry.result_column], block);
|
||||
|
||||
DiskSpace::ReservationPtr reservation = data.reserveSpacePreferringMoveDestination(expected_size, move_ttl_infos, time(nullptr));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user