mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
turn sql to bash
This commit is contained in:
parent
3f70977cd6
commit
1ba44252cd
@ -1,25 +1,4 @@
|
||||
-- { echoOn }
|
||||
insert into buffer_02572 values (1);
|
||||
-- ensure that the flush was not direct
|
||||
select * from buffer_02572;
|
||||
OK
|
||||
1
|
||||
1
|
||||
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 sleepEachRow(1) from numbers(3*2) format Null;
|
||||
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
|
||||
select * from buffer_02572;
|
||||
1
|
||||
select * from data_02572;
|
||||
1
|
||||
select * from copy_02572;
|
||||
1
|
||||
|
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,40 +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 buffer_02572;
|
||||
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 sleepEachRow(1) from numbers(3*2) format Null;
|
||||
|
||||
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
|
||||
;
|
||||
|
||||
select * from buffer_02572;
|
||||
select * from data_02572;
|
||||
select * from copy_02572;
|
Loading…
Reference in New Issue
Block a user