mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
Fix finished_mutations_to_keep=0 for MergeTree (as docs says 0 is to keep everything)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
bdc884dfa5
commit
f559767d22
@ -1479,8 +1479,11 @@ UInt64 StorageMergeTree::getCurrentMutationVersion(
|
|||||||
|
|
||||||
size_t StorageMergeTree::clearOldMutations(bool truncate)
|
size_t StorageMergeTree::clearOldMutations(bool truncate)
|
||||||
{
|
{
|
||||||
size_t finished_mutations_to_keep = truncate ? 0 : getSettings()->finished_mutations_to_keep;
|
size_t finished_mutations_to_keep = getSettings()->finished_mutations_to_keep;
|
||||||
|
if (!truncate && !finished_mutations_to_keep)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
finished_mutations_to_keep = truncate ? 0 : finished_mutations_to_keep;
|
||||||
std::vector<MergeTreeMutationEntry> mutations_to_delete;
|
std::vector<MergeTreeMutationEntry> mutations_to_delete;
|
||||||
{
|
{
|
||||||
std::lock_guard lock(currently_processing_in_background_mutex);
|
std::lock_guard lock(currently_processing_in_background_mutex);
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
mutations after ALTER for data_rmt 1
|
||||||
|
mutations after cleanup for data_rmt 1
|
||||||
|
mutations after ALTER for data_mt 1
|
||||||
|
mutations after cleanup for data_mt 1
|
@ -0,0 +1,14 @@
|
|||||||
|
drop table if exists data_rmt;
|
||||||
|
drop table if exists data_mt;
|
||||||
|
|
||||||
|
create table data_rmt (key Int) engine=ReplicatedMergeTree('/tables/{database}/data', '{table}') order by tuple() settings finished_mutations_to_keep=0, merge_tree_clear_old_parts_interval_seconds=1;
|
||||||
|
create table data_mt (key Int) engine=MergeTree() order by tuple() settings finished_mutations_to_keep=0, merge_tree_clear_old_parts_interval_seconds=1;
|
||||||
|
|
||||||
|
{% for table in ['data_rmt', 'data_mt'] %}
|
||||||
|
alter table {{table}} delete where 1;
|
||||||
|
select 'mutations after ALTER for {{table}}', count() from system.mutations where database = currentDatabase() and table = '{{table}}';
|
||||||
|
-- merge_tree_clear_old_parts_interval_seconds=1, but wait few seconds more
|
||||||
|
select sleep(5) settings function_sleep_max_microseconds_per_block=10e6 format Null;
|
||||||
|
select 'mutations after cleanup for {{table}}', count() from system.mutations where database = currentDatabase() and table = '{{table}}';
|
||||||
|
drop table {{table}};
|
||||||
|
{% endfor %}
|
Loading…
Reference in New Issue
Block a user