mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
Recompress TTLs in memory metadata
This commit is contained in:
parent
4834bed35b
commit
42c210fcba
@ -38,13 +38,16 @@ struct MergeTreeDataPartTTLInfos
|
||||
MergeTreeDataPartTTLInfo table_ttl;
|
||||
|
||||
/// `part_min_ttl` and `part_max_ttl` are TTLs which are used for selecting parts
|
||||
/// to merge in order to remove expired rows.
|
||||
/// to merge in order to remove expired rows.
|
||||
time_t part_min_ttl = 0;
|
||||
time_t part_max_ttl = 0;
|
||||
|
||||
/// Order is important as it would be serialized and hashed for checksums
|
||||
std::map<String, MergeTreeDataPartTTLInfo> moves_ttl;
|
||||
|
||||
/// Order is important as it would be serialized and hashed for checksums
|
||||
std::map<String, MergeTreeDataPartTTLInfo> recompression_ttl;
|
||||
|
||||
void read(ReadBuffer & in);
|
||||
void write(WriteBuffer & out) const;
|
||||
void update(const MergeTreeDataPartTTLInfos & other_infos);
|
||||
|
@ -234,6 +234,11 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataWriter::writeTempPart(BlockWithPa
|
||||
for (const auto & ttl_entry : move_ttl_entries)
|
||||
updateTTL(ttl_entry, move_ttl_infos, move_ttl_infos.moves_ttl[ttl_entry.result_column], block, false);
|
||||
|
||||
const auto & recompression_ttl_entries = metadata_snapshot->getRecompressionTTLs();
|
||||
for (const auto & ttl_entry : recompression_ttl_entries)
|
||||
updateTTL(ttl_entry, move_ttl_infos, move_ttl_infos.moves_ttl[ttl_entry.result_column], block, false);
|
||||
|
||||
|
||||
NamesAndTypesList columns = metadata_snapshot->getColumns().getAllPhysical().filter(block.getNames());
|
||||
ReservationPtr reservation = data.reserveSpacePreferringTTLRules(expected_size, move_ttl_infos, time(nullptr));
|
||||
VolumePtr volume = data.getStoragePolicy()->getVolume(0);
|
||||
|
@ -157,6 +157,16 @@ bool StorageInMemoryMetadata::hasAnyMoveTTL() const
|
||||
return !table_ttl.move_ttl.empty();
|
||||
}
|
||||
|
||||
TTLDescriptions StorageInMemoryMetadata::getRecompressionTTLs() const
|
||||
{
|
||||
return table_ttl.recompression_ttl;
|
||||
}
|
||||
|
||||
bool StorageInMemoryMetadata::hasAnyRecompressionTTL() const
|
||||
{
|
||||
return !table_ttl.recompression_ttl.empty();
|
||||
}
|
||||
|
||||
ColumnDependencies StorageInMemoryMetadata::getColumnDependencies(const NameSet & updated_columns) const
|
||||
{
|
||||
if (updated_columns.empty())
|
||||
|
@ -114,6 +114,10 @@ struct StorageInMemoryMetadata
|
||||
TTLDescriptions getMoveTTLs() const;
|
||||
bool hasAnyMoveTTL() const;
|
||||
|
||||
// Just wrapper for table TTLs, return info about recompression ttl
|
||||
TTLDescriptions getRecompressionTTLs() const;
|
||||
bool hasAnyRecompressionTTL() const;
|
||||
|
||||
/// Returns columns, which will be needed to calculate dependencies (skip
|
||||
/// indices, TTL expressions) if we update @updated_columns set of columns.
|
||||
ColumnDependencies getColumnDependencies(const NameSet & updated_columns) const;
|
||||
|
Loading…
Reference in New Issue
Block a user