Merge pull request #67158 from jsc0218/fix2572

Try to fix 2572
This commit is contained in:
Alexey Milovidov 2024-07-30 03:26:55 +02:00 committed by GitHub
commit 9b99abc2cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 53 deletions

View File

@ -1,20 +1,4 @@
-- { echoOn }
insert into buffer_02572 values (1);
-- ensure that the flush was not direct
select * from data_02572;
select * from copy_02572;
-- we cannot use OPTIMIZE, this will attach query context, so let's wait
SET function_sleep_max_microseconds_per_block = 6000000;
select sleepEachRow(1) from numbers(3*2) format Null;
select * from data_02572;
OK
1
select * from copy_02572;
1
system flush logs;
select count() > 0, lower(status::String), errorCodeToName(exception_code)
from system.query_views_log where
view_name = concatWithSeparator('.', currentDatabase(), 'mv_02572') and
view_target = concatWithSeparator('.', currentDatabase(), 'copy_02572')
group by 2, 3
;
1 queryfinish OK

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
# INSERT buffer_02572 -> data_02572 -> copy_02572
# ^^
# push to system.query_views_log
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
${CLICKHOUSE_CLIENT} --ignore-error --multiquery --query "drop table if exists buffer_02572;
drop table if exists data_02572; drop table if exists copy_02572; drop table if exists mv_02572;"
${CLICKHOUSE_CLIENT} --query="create table copy_02572 (key Int) engine=Memory();"
${CLICKHOUSE_CLIENT} --query="create table data_02572 (key Int) engine=Memory();"
${CLICKHOUSE_CLIENT} --query="create table buffer_02572 (key Int) engine=Buffer(currentDatabase(), data_02572, 1, 3, 3, 1, 1e9, 1, 1e9);"
${CLICKHOUSE_CLIENT} --query="create materialized view mv_02572 to copy_02572 as select * from data_02572;"
${CLICKHOUSE_CLIENT} --query="insert into buffer_02572 values (1);"
# ensure that the flush was not direct
${CLICKHOUSE_CLIENT} --ignore-error --multiquery --query "select * from data_02572; select * from copy_02572;"
# we cannot use OPTIMIZE, this will attach query context, so let's wait
for _ in {1..100}; do
$CLICKHOUSE_CLIENT -q "select * from data_02572;" | grep -q "1" && echo 'OK' && break
sleep 0.5
done
${CLICKHOUSE_CLIENT} --ignore-error --multiquery --query "select * from data_02572; select * from copy_02572;"
${CLICKHOUSE_CLIENT} --query="system flush logs;"
${CLICKHOUSE_CLIENT} --query="select count() > 0, lower(status::String), errorCodeToName(exception_code)
from system.query_views_log where
view_name = concatWithSeparator('.', currentDatabase(), 'mv_02572') and
view_target = concatWithSeparator('.', currentDatabase(), 'copy_02572')
group by 2, 3;"

View File

@ -1,36 +0,0 @@
-- INSERT buffer_02572 -> data_02572 -> copy_02572
-- ^^
-- push to system.query_views_log
drop table if exists buffer_02572;
drop table if exists data_02572;
drop table if exists copy_02572;
drop table if exists mv_02572;
create table copy_02572 (key Int) engine=Memory();
create table data_02572 (key Int) engine=Memory();
create table buffer_02572 (key Int) engine=Buffer(currentDatabase(), data_02572, 1,
/* never direct flush for flush from background thread */
/* min_time= */ 3, 3,
1, 1e9,
1, 1e9);
create materialized view mv_02572 to copy_02572 as select * from data_02572;
-- { echoOn }
insert into buffer_02572 values (1);
-- ensure that the flush was not direct
select * from data_02572;
select * from copy_02572;
-- we cannot use OPTIMIZE, this will attach query context, so let's wait
SET function_sleep_max_microseconds_per_block = 6000000;
select sleepEachRow(1) from numbers(3*2) format Null;
select * from data_02572;
select * from copy_02572;
system flush logs;
select count() > 0, lower(status::String), errorCodeToName(exception_code)
from system.query_views_log where
view_name = concatWithSeparator('.', currentDatabase(), 'mv_02572') and
view_target = concatWithSeparator('.', currentDatabase(), 'copy_02572')
group by 2, 3
;