mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
commit
9b99abc2cf
@ -1,20 +1,4 @@
|
|||||||
-- { echoOn }
|
OK
|
||||||
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;
|
|
||||||
1
|
1
|
||||||
select * from copy_02572;
|
|
||||||
1
|
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
|
1 queryfinish OK
|
||||||
|
38
tests/queries/0_stateless/02572_query_views_log_background_thread.sh
Executable file
38
tests/queries/0_stateless/02572_query_views_log_background_thread.sh
Executable 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;"
|
@ -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
|
|
||||||
;
|
|
Loading…
Reference in New Issue
Block a user