Merge pull request #22947 from azat/inactive_parts_to_throw_insert-fix

Fix inactive_parts_to_throw_insert=0 with inactive_parts_to_delay_insert>0
This commit is contained in:
alexey-milovidov 2021-04-10 23:21:16 +03:00 committed by GitHub
commit e9b39c40f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 13 deletions

View File

@ -2538,7 +2538,7 @@ void MergeTreeData::delayInsertOrThrowIfNeeded(Poco::Event * until) const
if (settings->inactive_parts_to_throw_insert > 0 || settings->inactive_parts_to_delay_insert > 0)
{
size_t inactive_parts_count_in_partition = getMaxInactivePartsCountForPartition();
if (inactive_parts_count_in_partition >= settings->inactive_parts_to_throw_insert)
if (settings->inactive_parts_to_throw_insert > 0 && inactive_parts_count_in_partition >= settings->inactive_parts_to_throw_insert)
{
ProfileEvents::increment(ProfileEvents::RejectedInserts);
throw Exception(

View File

@ -1,12 +0,0 @@
drop table if exists x;
create table x (i int) engine MergeTree order by i settings old_parts_lifetime = 10000000000, min_bytes_for_wide_part = 0, inactive_parts_to_throw_insert = 1;
insert into x values (1);
insert into x values (2);
optimize table x final;
insert into x values (3); -- { serverError 252; }
drop table if exists x;

View File

@ -0,0 +1,12 @@
drop table if exists data_01709;
create table data_01709 (i int) engine MergeTree order by i settings old_parts_lifetime = 10000000000, min_bytes_for_wide_part = 0, inactive_parts_to_throw_insert = 1;
insert into data_01709 values (1);
insert into data_01709 values (2);
optimize table data_01709 final;
insert into data_01709 values (3); -- { serverError 252; }
drop table data_01709;

View File

@ -0,0 +1,12 @@
drop table if exists data_01809;
create table data_01809 (i int) engine MergeTree order by i settings old_parts_lifetime = 10000000000, min_bytes_for_wide_part = 0, inactive_parts_to_throw_insert = 0, inactive_parts_to_delay_insert = 1;
insert into data_01809 values (1);
insert into data_01809 values (2);
optimize table data_01809 final;
insert into data_01809 values (3);
drop table data_01809;