mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
modify test cases
This commit is contained in:
parent
fa1f069793
commit
eb555fc719
@ -4,8 +4,7 @@ set materialize_ttl_after_modify = 0;
|
|||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d)
|
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d)
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
||||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
||||||
@ -21,15 +20,13 @@ select * from ttl order by a;
|
|||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by a;
|
select * from ttl order by a;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
select * from ttl order by a;
|
select * from ttl order by a;
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (i Int, s String) engine = MergeTree order by i
|
create table ttl (i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
||||||
|
|
||||||
@ -37,25 +34,20 @@ alter table ttl modify ttl i % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
|||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
alter table ttl modify ttl toDate('2000-01-01');
|
alter table ttl modify ttl toDate('2000-01-01');
|
||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (i Int, s String) engine = MergeTree order by i
|
create table ttl (i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
||||||
|
|
||||||
@ -66,25 +58,20 @@ select * from ttl order by i;
|
|||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
alter table ttl modify column s String ttl toDate('2000-01-01');
|
alter table ttl modify column s String ttl toDate('2000-01-01');
|
||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (d Date, i Int, s String) engine = MergeTree order by i
|
create table ttl (d Date, i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (toDate('2000-01-02'), 1, 'a') (toDate('2000-01-03'), 2, 'b') (toDate('2080-01-01'), 3, 'c') (toDate('2080-01-03'), 4, 'd');
|
insert into ttl values (toDate('2000-01-02'), 1, 'a') (toDate('2000-01-03'), 2, 'b') (toDate('2080-01-01'), 3, 'c') (toDate('2080-01-03'), 4, 'd');
|
||||||
|
|
||||||
@ -92,18 +79,14 @@ alter table ttl modify ttl i % 3 = 0 ? today() - 10 : toDate('2100-01-01');
|
|||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
alter table ttl modify column s String ttl d + interval 1 month;
|
alter table ttl modify column s String ttl d + interval 1 month;
|
||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
@ -2,8 +2,7 @@ drop table if exists ttl;
|
|||||||
set mutations_sync = 2;
|
set mutations_sync = 2;
|
||||||
|
|
||||||
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d)
|
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d)
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
||||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
||||||
@ -13,95 +12,77 @@ insert into ttl values (toDateTime('2100-10-10 00:00:00'), 4);
|
|||||||
alter table ttl modify ttl d + interval 1 day;
|
alter table ttl modify ttl d + interval 1 day;
|
||||||
select * from ttl order by a;
|
select * from ttl order by a;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by a;
|
select * from ttl order by a;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (i Int, s String) engine = MergeTree order by i
|
create table ttl (i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
||||||
|
|
||||||
alter table ttl modify ttl i % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
alter table ttl modify ttl i % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
alter table ttl modify ttl toDate('2000-01-01');
|
alter table ttl modify ttl toDate('2000-01-01');
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (i Int, s String) engine = MergeTree order by i
|
create table ttl (i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
insert into ttl values (1, 'a') (2, 'b') (3, 'c') (4, 'd');
|
||||||
|
|
||||||
alter table ttl modify column s String ttl i % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
alter table ttl modify column s String ttl i % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
alter table ttl modify column s String ttl toDate('2000-01-01');
|
alter table ttl modify column s String ttl toDate('2000-01-01');
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (d Date, i Int, s String) engine = MergeTree order by i
|
create table ttl (d Date, i Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (toDate('2000-01-02'), 1, 'a') (toDate('2000-01-03'), 2, 'b') (toDate('2080-01-01'), 3, 'c') (toDate('2080-01-03'), 4, 'd');
|
insert into ttl values (toDate('2000-01-02'), 1, 'a') (toDate('2000-01-03'), 2, 'b') (toDate('2080-01-01'), 3, 'c') (toDate('2080-01-03'), 4, 'd');
|
||||||
|
|
||||||
alter table ttl modify ttl i % 3 = 0 ? today() - 10 : toDate('2100-01-01');
|
alter table ttl modify ttl i % 3 = 0 ? today() - 10 : toDate('2100-01-01');
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
alter table ttl modify column s String ttl d + interval 1 month;
|
alter table ttl modify column s String ttl d + interval 1 month;
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select i, s from ttl order by i;
|
select i, s from ttl order by i;
|
||||||
select '=============';
|
select '=============';
|
||||||
|
|
||||||
drop table if exists ttl;
|
drop table if exists ttl;
|
||||||
|
|
||||||
create table ttl (i Int, s String, t String) engine = MergeTree order by i
|
create table ttl (i Int, s String, t String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 'a', 'aa') (2, 'b', 'bb') (3, 'c', 'cc') (4, 'd', 'dd');
|
insert into ttl values (1, 'a', 'aa') (2, 'b', 'bb') (3, 'c', 'cc') (4, 'd', 'dd');
|
||||||
|
|
||||||
@ -109,9 +90,7 @@ alter table ttl modify column s String ttl i % 3 = 0 ? today() - 10 : toDate('21
|
|||||||
modify column t String ttl i % 3 = 1 ? today() - 10 : toDate('2100-01-01');
|
modify column t String ttl i % 3 = 1 ? today() - 10 : toDate('2100-01-01');
|
||||||
select i, s, t from ttl order by i;
|
select i, s, t from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select i, s, t from ttl order by i;
|
select i, s, t from ttl order by i;
|
||||||
|
|
||||||
-- MATERIALIZE TTL ran only once
|
-- MATERIALIZE TTL ran only once
|
||||||
@ -122,8 +101,7 @@ drop table if exists ttl;
|
|||||||
|
|
||||||
-- Nothing changed, don't run mutation
|
-- Nothing changed, don't run mutation
|
||||||
create table ttl (i Int, s String ttl toDate('2000-01-02')) engine = MergeTree order by i
|
create table ttl (i Int, s String ttl toDate('2000-01-02')) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
alter table ttl modify column s String ttl toDate('2000-01-02');
|
alter table ttl modify column s String ttl toDate('2000-01-02');
|
||||||
select count() from system.mutations where table = 'ttl' and is_done;
|
select count() from system.mutations where table = 'ttl' and is_done;
|
||||||
|
@ -3,8 +3,7 @@ set mutations_sync = 2;
|
|||||||
|
|
||||||
-- check that ttl info was updated after mutation.
|
-- check that ttl info was updated after mutation.
|
||||||
create table ttl (i Int, a Int, s String) engine = MergeTree order by i
|
create table ttl (i Int, a Int, s String) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 1, 'a') (2, 1, 'b') (3, 1, 'c') (4, 1, 'd');
|
insert into ttl values (1, 1, 'a') (2, 1, 'b') (3, 1, 'c') (4, 1, 'd');
|
||||||
|
|
||||||
@ -12,17 +11,13 @@ alter table ttl modify ttl a % 2 = 0 ? today() - 10 : toDate('2100-01-01');
|
|||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
alter table ttl update a = 0 where i % 2 = 0;
|
alter table ttl update a = 0 where i % 2 = 0;
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select * from ttl order by i;
|
select * from ttl order by i;
|
||||||
|
|
||||||
drop table ttl;
|
drop table ttl;
|
||||||
@ -32,8 +27,7 @@ select '===================';
|
|||||||
-- check that skip index is updated after column was modified by ttl.
|
-- check that skip index is updated after column was modified by ttl.
|
||||||
create table ttl (i Int, a Int, s String default 'b' ttl a % 2 = 0 ? today() - 10 : toDate('2100-01-01'),
|
create table ttl (i Int, a Int, s String default 'b' ttl a % 2 = 0 ? today() - 10 : toDate('2100-01-01'),
|
||||||
index ind_s (s) type set(1) granularity 1) engine = MergeTree order by i
|
index ind_s (s) type set(1) granularity 1) engine = MergeTree order by i
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 1, 'a') (2, 1, 'a') (3, 1, 'a') (4, 1, 'a');
|
insert into ttl values (1, 1, 'a') (2, 1, 'a') (3, 1, 'a') (4, 1, 'a');
|
||||||
|
|
||||||
@ -43,9 +37,7 @@ alter table ttl update a = 0 where i % 2 = 0;
|
|||||||
select count() from ttl where s = 'a';
|
select count() from ttl where s = 'a';
|
||||||
select count() from ttl where s = 'b';
|
select count() from ttl where s = 'b';
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
select count() from ttl where s = 'a';
|
select count() from ttl where s = 'a';
|
||||||
select count() from ttl where s = 'b';
|
select count() from ttl where s = 'b';
|
||||||
|
|
||||||
@ -53,22 +45,19 @@ drop table ttl;
|
|||||||
|
|
||||||
-- check only that it doesn't throw exceptions.
|
-- check only that it doesn't throw exceptions.
|
||||||
create table ttl (i Int, s String) engine = MergeTree order by i ttl toDate('2000-01-01') TO DISK 'default'
|
create table ttl (i Int, s String) engine = MergeTree order by i ttl toDate('2000-01-01') TO DISK 'default'
|
||||||
SETTINGS merge_with_ttl_timeout=0;
|
SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
drop table ttl;
|
drop table ttl;
|
||||||
|
|
||||||
create table ttl (a Int, b Int, c Int default 42 ttl d, d Date, index ind (b * c) type minmax granularity 1)
|
create table ttl (a Int, b Int, c Int default 42 ttl d, d Date, index ind (b * c) type minmax granularity 1)
|
||||||
engine = MergeTree order by a SETTINGS merge_with_ttl_timeout=0;
|
engine = MergeTree order by a SETTINGS max_number_of_merges_with_ttl_in_pool=0;
|
||||||
SYSTEM STOP TTL MERGES ttl;
|
|
||||||
|
|
||||||
insert into ttl values (1, 2, 3, '2100-01-01');
|
insert into ttl values (1, 2, 3, '2100-01-01');
|
||||||
alter table ttl update d = '2000-01-01' where 1;
|
alter table ttl update d = '2000-01-01' where 1;
|
||||||
alter table ttl materialize ttl;
|
alter table ttl materialize ttl;
|
||||||
select * from ttl;
|
select * from ttl;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES ttl;
|
optimize table ttl final;
|
||||||
optimize table ttl;
|
|
||||||
select * from ttl;
|
select * from ttl;
|
||||||
drop table ttl;
|
drop table ttl;
|
||||||
|
@ -28,7 +28,7 @@ ALTER TABLE table_rename_with_ttl materialize TTL;
|
|||||||
SELECT count() FROM table_rename_with_ttl;
|
SELECT count() FROM table_rename_with_ttl;
|
||||||
|
|
||||||
SYSTEM START TTL MERGES table_rename_with_ttl;
|
SYSTEM START TTL MERGES table_rename_with_ttl;
|
||||||
optimize table table_rename_with_ttl;
|
optimize table table_rename_with_ttl FINAL;
|
||||||
|
|
||||||
SELECT count() FROM table_rename_with_ttl;
|
SELECT count() FROM table_rename_with_ttl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user