1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Tests: split versioning.select into combinations

This commit is contained in:
Aleksey Midenkov
2017-03-15 18:36:54 +03:00
parent fb0b3e5902
commit 1894fab11a
18 changed files with 486 additions and 186 deletions

View File

@ -1,5 +1,3 @@
-- source include/have_innodb.inc
set @@session.time_zone='+00:00';
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
@ -19,4 +17,53 @@ begin
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
delimiter ;~~

View File

@ -1 +1,17 @@
--loose-innodb-vtq
--innodb
--innodb-cmpmem
--innodb-cmp-per-index
--innodb-trx
--innodb-locks
--innodb-metrics
--innodb-buffer-pool-stats
--innodb-buffer-page
--innodb-buffer-page-lru
--innodb-sys-columns
--innodb-sys-fields
--innodb-sys-foreign
--innodb-sys-foreign-cols
--innodb-sys-indexes
--innodb-sys-tables
--innodb-sys-virtual
--innodb-vtq

View File

@ -0,0 +1,5 @@
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -248,6 +248,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create or replace table t(
a int
) engine=innodb;
@ -448,3 +493,7 @@ No A B C D
11 1 1 1 1
drop table t;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
@ -135,3 +180,7 @@ No A B C D
11 1 1 1 1
drop procedure test_01;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create table t1(
id int auto_increment primary key)
with system versioning
@ -101,3 +146,7 @@ No A B C D
6 1 1 1 1
7 1 1 1 1
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create or replace procedure test_01(
sys_type varchar(255),
engine varchar(255),
@ -308,3 +353,7 @@ drop procedure test_01;
drop procedure test_02;
drop procedure test_03;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
@ -305,3 +350,7 @@ drop procedure test_03;
drop procedure test_04;
drop procedure test_05;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,11 +15,56 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
fields varchar(255))
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create procedure test_01()
begin
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype();
declare fields varchar(255) default sys_commit_ts('sys_start');
set @str= concat('
create table t1(
x int unsigned,
@ -66,14 +111,20 @@ select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transacti
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and transaction @x1;
select x as FROMTO2_ext_x, y from t1 for system_time transaction from 0 to @x1;
select x as BETWAND2_ext_x, y from t1 for system_time transaction between 0 and @x1;
else
select x as ASOF2_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO2_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO2_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND2_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
end if;
drop table t1;
end~~
create or replace procedure test_02(
sys_type varchar(255),
engine varchar(255),
fields varchar(255))
create or replace procedure test_02()
begin
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype();
declare fields varchar(255) default sys_commit_ts('sys_start');
set @str0= concat('(
x int,
y int,
@ -103,86 +154,7 @@ query for system_time as of timestamp @t0;
drop table t1;
drop table t2;
end~~
call test_01('timestamp(6)', 'myisam', 'sys_start');
x y
0 100
1 101
2 102
4 104
5 105
6 106
7 107
3 33
ASOF_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
FROMTO_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
FROMTO_ext_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND_ext_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
ALL_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
call test_01();
x y
0 100
1 101
@ -318,40 +290,7 @@ BETWAND2_ext_x y
8 108
9 109
3 33
call test_02('timestamp(6)', 'myisam', 'sys_start');
IJ1_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
LJ1_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
4 4 NULL NULL
5 5 NULL NULL
RJ1_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
NULL NULL 2 1
NULL NULL 3 1
IJ2_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
LJ2_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
4 4 NULL NULL
5 5 NULL NULL
RJ2_x1 y1 x2 y2
1 1 1 2
1 2 1 2
1 3 1 2
NULL NULL 2 1
NULL NULL 3 1
call test_02('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
call test_02();
IJ1_x1 y1 x2 y2
1 1 1 2
1 2 1 2
@ -386,14 +325,7 @@ NULL NULL 2 1
NULL NULL 3 1
create table t1(
A int
) with system versioning engine=myisam;
insert into t1 values(1);
select * from t1;
A
1
create or replace table t1(
A int
) with system versioning engine=innodb;
) with system versioning;
insert into t1 values(1);
select * from t1;
A
@ -435,15 +367,7 @@ for each row set @end = old.sys_trx_end;
update t1 set a=2;
select @end;
@end
2038-01-19 03:14:07.000000
create or replace table t1 (a int) with system versioning engine=innodb;
insert into t1 values (1);
create trigger read_end after update on t1
for each row set @end = old.sys_trx_end;
update t1 set a=2;
select @end;
@end
18446744073709551615
MAX_RESULT
create or replace table t1 (a int) with system versioning;
create or replace table t2 (b int) with system versioning;
insert into t1 values (1);
@ -467,7 +391,7 @@ a1 a2
1 2
2 2
drop table t1, t2;
call verify_vtq;
call innodb_verify_vtq(19);
No A B C D
1 1 1 1 1
2 1 1 1 1
@ -480,6 +404,18 @@ No A B C D
9 1 1 1 1
10 1 1 1 1
11 1 1 1 1
12 1 1 1 1
13 1 1 1 1
14 1 1 1 1
15 1 1 1 1
16 1 1 1 1
17 1 1 1 1
18 1 1 1 1
19 1 1 1 1
drop procedure test_01;
drop procedure test_02;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
into @start_trx_id
from information_schema.innodb_vtq;
end~~
create function if not exists default_engine()
returns varchar(255)
deterministic
begin
declare e varchar(255);
select lower(engine) from information_schema.engines where support='DEFAULT' into e;
return e;
end~~
create function if not exists sys_datatype()
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return 'bigint unsigned';
elseif default_engine() = 'myisam' then
return 'timestamp(6)';
end if;
return NULL;
end~~
create function if not exists sys_commit_ts(sys_field varchar(255))
returns varchar(255)
deterministic
begin
if default_engine() = 'innodb' then
return concat('vtq_commit_ts(', sys_field, ')');
elseif default_engine() = 'myisam' then
return sys_field;
end if;
return NULL;
end~~
create procedure if not exists innodb_verify_vtq(recs int)
begin
declare i int default 1;
if default_engine() = 'innodb' then
call verify_vtq;
elseif default_engine() = 'myisam' then
create temporary table tmp (No int, A bool, B bool, C bool, D bool);
while i <= recs do
insert into tmp values (i, 1, 1, 1, 1);
set i= i + 1;
end while;
select * from tmp;
drop table tmp;
end if;
end~~
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
@ -528,3 +573,7 @@ drop procedure test_05;
drop procedure test_06;
drop procedure test_07;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;

View File

@ -204,4 +204,5 @@ select * from t;
call verify_vtq;
drop table t;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -64,5 +64,5 @@ call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
call verify_vtq;
drop procedure test_01;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -6,7 +6,6 @@ with system versioning
engine innodb;
# VTQ_ISO_LEVEL #
set transaction isolation level read uncommitted;
@ -76,4 +75,5 @@ select
drop table t1;
call verify_vtq;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -117,4 +117,5 @@ call verify_vtq;
drop procedure test_01;
drop procedure test_02;
drop procedure test_03;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -193,4 +193,5 @@ drop procedure test_02;
drop procedure test_03;
drop procedure test_04;
drop procedure test_05;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -0,0 +1,5 @@
[innodb]
default-storage-engine=innodb
[myisam]
default-storage-engine=myisam

View File

@ -1,11 +1,12 @@
-- source suite/versioning/common.inc
delimiter ~~;
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
fields varchar(255))
create procedure test_01()
begin
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype();
declare fields varchar(255) default sys_commit_ts('sys_start');
set @str= concat('
create table t1(
x int unsigned,
@ -51,21 +52,28 @@ begin
select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and transaction @x1;
select x as FROMTO2_ext_x, y from t1 for system_time transaction from 0 to @x1;
select x as BETWAND2_ext_x, y from t1 for system_time transaction between 0 and @x1;
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and transaction @x1;
select x as FROMTO2_ext_x, y from t1 for system_time transaction from 0 to @x1;
select x as BETWAND2_ext_x, y from t1 for system_time transaction between 0 and @x1;
else
select x as ASOF2_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO2_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO2_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND2_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
end if;
drop table t1;
end~~
create or replace procedure test_02(
sys_type varchar(255),
engine varchar(255),
fields varchar(255))
create or replace procedure test_02()
begin
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype();
declare fields varchar(255) default sys_commit_ts('sys_start');
set @str0= concat('(
x int,
y int,
@ -102,22 +110,13 @@ begin
end~~
delimiter ;~~
call test_01('timestamp(6)', 'myisam', 'sys_start');
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
call test_02('timestamp(6)', 'myisam', 'sys_start');
call test_02('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
call test_01();
call test_02();
# wildcard expansion on hidden fields.
create table t1(
A int
) with system versioning engine=myisam;
insert into t1 values(1);
select * from t1;
create or replace table t1(
A int
) with system versioning engine=innodb;
) with system versioning;
insert into t1 values(1);
select * from t1;
@ -151,20 +150,13 @@ drop view vt1;
create or replace table t1(x int) with system versioning;
select * from (t1 as r left join t1 as u using (x)), t1;
# @end should be max timestamp
# @end should be max
create or replace table t1 (a int) with system versioning;
insert into t1 values (1);
create trigger read_end after update on t1
for each row set @end = old.sys_trx_end;
update t1 set a=2;
select @end;
# @end should be max trx_id
create or replace table t1 (a int) with system versioning engine=innodb;
insert into t1 values (1);
create trigger read_end after update on t1
for each row set @end = old.sys_trx_end;
update t1 set a=2;
--replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.000000" MAX_RESULT
select @end;
create or replace table t1 (a int) with system versioning;
@ -183,8 +175,9 @@ select * from t1 for system_time all natural left join t2 for system_time all;
drop table t1, t2;
call verify_vtq;
call innodb_verify_vtq(19);
drop procedure test_01;
drop procedure test_02;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc

View File

@ -263,4 +263,5 @@ drop procedure test_04;
drop procedure test_05;
drop procedure test_06;
drop procedure test_07;
drop procedure verify_vtq;
-- source suite/versioning/common_finish.inc