mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
pass proper time for TTL
This commit is contained in:
parent
803d9da496
commit
2f30a1350b
@ -459,9 +459,6 @@ public:
|
||||
/// Returns names of primary key + secondary sorting columns
|
||||
virtual Names getSortingKeyColumns() const { return {}; }
|
||||
|
||||
/// Returns columns that could be updated by applying TTL rules
|
||||
virtual Names getColumnsUpdatedByTTL() const { return {}; }
|
||||
|
||||
/// Returns columns, whose dependencies (skip indices, TTL expressions)
|
||||
/// would be affected if we will update @updated_columns set of columns.
|
||||
virtual ColumnDependencies getColumnDependencies(const NameSet & /* updated_columns */) const { return {}; }
|
||||
|
@ -918,6 +918,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor
|
||||
const FutureMergedMutatedPart & future_part,
|
||||
const std::vector<MutationCommand> & commands,
|
||||
MergeListEntry & merge_entry,
|
||||
time_t time_of_mutation,
|
||||
const Context & context,
|
||||
const ReservationPtr & space_reservation,
|
||||
TableStructureReadLockHolder & table_lock_holder)
|
||||
@ -1025,7 +1026,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor
|
||||
std::make_shared<ExpressionBlockInputStream>(in, data.primary_key_and_skip_indices_expr));
|
||||
|
||||
if (need_remove_expired_values)
|
||||
in = std::make_shared<TTLBlockInputStream>(in, data, new_data_part, time(nullptr), true);
|
||||
in = std::make_shared<TTLBlockInputStream>(in, data, new_data_part, time_of_mutation, true);
|
||||
|
||||
MergeTreeDataPart::MinMaxIndex minmax_idx;
|
||||
|
||||
@ -1133,7 +1134,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor
|
||||
merge_entry->columns_written = all_columns.size() - updated_header.columns();
|
||||
|
||||
if (need_remove_expired_values)
|
||||
in = std::make_shared<TTLBlockInputStream>(in, data, new_data_part, time(nullptr), true);
|
||||
in = std::make_shared<TTLBlockInputStream>(in, data, new_data_part, time_of_mutation, true);
|
||||
|
||||
IMergedBlockOutputStream::WrittenOffsetColumns unused_written_offsets;
|
||||
MergedColumnOnlyOutputStream out(
|
||||
|
@ -105,7 +105,9 @@ public:
|
||||
MergeTreeData::MutableDataPartPtr mutatePartToTemporaryPart(
|
||||
const FutureMergedMutatedPart & future_part,
|
||||
const std::vector<MutationCommand> & commands,
|
||||
MergeListEntry & merge_entry, const Context & context,
|
||||
MergeListEntry & merge_entry,
|
||||
time_t time_of_mutation,
|
||||
const Context & context,
|
||||
const ReservationPtr & disk_reservation,
|
||||
TableStructureReadLockHolder & table_lock_holder);
|
||||
|
||||
|
@ -785,8 +785,8 @@ bool StorageMergeTree::tryMutatePart()
|
||||
|
||||
try
|
||||
{
|
||||
new_part = merger_mutator.mutatePartToTemporaryPart(future_part, commands, *merge_entry, global_context,
|
||||
tagger->reserved_space, table_lock_holder);
|
||||
new_part = merger_mutator.mutatePartToTemporaryPart(future_part, commands, *merge_entry,
|
||||
time(nullptr), global_context, tagger->reserved_space, table_lock_holder);
|
||||
|
||||
renameTempPartAndReplace(new_part);
|
||||
removeEmptyColumnsFromPart(new_part);
|
||||
|
@ -1237,7 +1237,7 @@ bool StorageReplicatedMergeTree::tryExecutePartMutation(const StorageReplicatedM
|
||||
|
||||
try
|
||||
{
|
||||
new_part = merger_mutator.mutatePartToTemporaryPart(future_mutated_part, commands, *merge_entry, global_context, reserved_space, table_lock);
|
||||
new_part = merger_mutator.mutatePartToTemporaryPart(future_mutated_part, commands, *merge_entry, entry.create_time, global_context, reserved_space, table_lock);
|
||||
renameTempPartAndReplace(new_part, nullptr, &transaction);
|
||||
removeEmptyColumnsFromPart(new_part);
|
||||
|
||||
|
@ -30,7 +30,7 @@ select count() from ttl where s = 'b';
|
||||
|
||||
drop table ttl;
|
||||
|
||||
-- check only that it doesn't throws exceptions.
|
||||
-- check only that it doesn't throw exceptions.
|
||||
create table ttl (i Int, s String) engine = MergeTree order by i ttl toDate('2000-01-01') TO DISK 'default';
|
||||
alter table ttl materialize ttl;
|
||||
drop table ttl;
|
||||
|
Loading…
Reference in New Issue
Block a user