From d768a2ac71905474653b8a9cb6ff778641e4f975 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 13 May 2021 22:35:01 +0300 Subject: [PATCH] Add a test for Buffer flush before shutdown --- .../0_stateless/01870_buffer_flush.reference | 2 ++ .../0_stateless/01870_buffer_flush.sql | 26 +++++++++++++++++++ tests/queries/skip_list.json | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/queries/0_stateless/01870_buffer_flush.reference create mode 100644 tests/queries/0_stateless/01870_buffer_flush.sql diff --git a/tests/queries/0_stateless/01870_buffer_flush.reference b/tests/queries/0_stateless/01870_buffer_flush.reference new file mode 100644 index 00000000000..fd3306644d5 --- /dev/null +++ b/tests/queries/0_stateless/01870_buffer_flush.reference @@ -0,0 +1,2 @@ +0 +5 diff --git a/tests/queries/0_stateless/01870_buffer_flush.sql b/tests/queries/0_stateless/01870_buffer_flush.sql new file mode 100644 index 00000000000..55ec79325dc --- /dev/null +++ b/tests/queries/0_stateless/01870_buffer_flush.sql @@ -0,0 +1,26 @@ +-- Check that Buffer will be flushed before shutdown +-- (via DETACH DATABASE) + +drop database if exists db_01870; +create database db_01870; + +-- Right now the order for shutdown is defined and it is: +-- (prefixes are important, to define the order) +-- - a_data_01870 +-- - z_buffer_01870 +-- so on DETACH DATABASE the following error will be printed: +-- +-- Destination table default.a_data_01870 doesn't exist. Block of data is discarded. +create table db_01870.a_data_01870 as system.numbers Engine=TinyLog(); +create table db_01870.z_buffer_01870 as system.numbers Engine=Buffer(db_01870, a_data_01870, 1, + 100, 100, /* time */ + 100, 100, /* rows */ + 100, 1e6 /* bytes */ +); +insert into db_01870.z_buffer_01870 select * from system.numbers limit 5; +select count() from db_01870.a_data_01870; +detach database db_01870; +attach database db_01870; +select count() from db_01870.a_data_01870; + +drop database db_01870; diff --git a/tests/queries/skip_list.json b/tests/queries/skip_list.json index 0a7acc08664..e29f9efde68 100644 --- a/tests/queries/skip_list.json +++ b/tests/queries/skip_list.json @@ -720,6 +720,7 @@ "01804_dictionary_decimal256_type", "01850_dist_INSERT_preserve_error", // uses cluster with different static databases shard_0/shard_1 "01821_table_comment", - "01710_projection_fetch" + "01710_projection_fetch", + "01870_buffer_flush" // creates database ] }