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:
@ -1,5 +1,3 @@
|
|||||||
-- source include/have_innodb.inc
|
|
||||||
|
|
||||||
set @@session.time_zone='+00:00';
|
set @@session.time_zone='+00:00';
|
||||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||||
|
|
||||||
@ -19,4 +17,53 @@ begin
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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 ;~~
|
delimiter ;~~
|
||||||
|
@ -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
|
||||||
|
5
mysql-test/suite/versioning/common_finish.inc
Normal file
5
mysql-test/suite/versioning/common_finish.inc
Normal 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;
|
@ -248,6 +248,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create or replace table t(
|
||||||
a int
|
a int
|
||||||
) engine=innodb;
|
) engine=innodb;
|
||||||
@ -448,3 +493,7 @@ No A B C D
|
|||||||
11 1 1 1 1
|
11 1 1 1 1
|
||||||
drop table t;
|
drop table t;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create procedure test_01(
|
||||||
sys_type varchar(255),
|
sys_type varchar(255),
|
||||||
engine varchar(255),
|
engine varchar(255),
|
||||||
@ -135,3 +180,7 @@ No A B C D
|
|||||||
11 1 1 1 1
|
11 1 1 1 1
|
||||||
drop procedure test_01;
|
drop procedure test_01;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create table t1(
|
||||||
id int auto_increment primary key)
|
id int auto_increment primary key)
|
||||||
with system versioning
|
with system versioning
|
||||||
@ -101,3 +146,7 @@ No A B C D
|
|||||||
6 1 1 1 1
|
6 1 1 1 1
|
||||||
7 1 1 1 1
|
7 1 1 1 1
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create or replace procedure test_01(
|
||||||
sys_type varchar(255),
|
sys_type varchar(255),
|
||||||
engine varchar(255),
|
engine varchar(255),
|
||||||
@ -308,3 +353,7 @@ drop procedure test_01;
|
|||||||
drop procedure test_02;
|
drop procedure test_02;
|
||||||
drop procedure test_03;
|
drop procedure test_03;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create procedure test_01(
|
||||||
sys_type varchar(255),
|
sys_type varchar(255),
|
||||||
engine varchar(255),
|
engine varchar(255),
|
||||||
@ -305,3 +350,7 @@ drop procedure test_03;
|
|||||||
drop procedure test_04;
|
drop procedure test_04;
|
||||||
drop procedure test_05;
|
drop procedure test_05;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,11 +15,56 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
end~~
|
||||||
create procedure test_01(
|
create function if not exists default_engine()
|
||||||
sys_type varchar(255),
|
returns varchar(255)
|
||||||
engine varchar(255),
|
deterministic
|
||||||
fields varchar(255))
|
|
||||||
begin
|
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('
|
set @str= concat('
|
||||||
create table t1(
|
create table t1(
|
||||||
x int unsigned,
|
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 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 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 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;
|
end if;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
end~~
|
end~~
|
||||||
create or replace procedure test_02(
|
create or replace procedure test_02()
|
||||||
sys_type varchar(255),
|
|
||||||
engine varchar(255),
|
|
||||||
fields varchar(255))
|
|
||||||
begin
|
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('(
|
set @str0= concat('(
|
||||||
x int,
|
x int,
|
||||||
y int,
|
y int,
|
||||||
@ -103,86 +154,7 @@ query for system_time as of timestamp @t0;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
drop table t2;
|
drop table t2;
|
||||||
end~~
|
end~~
|
||||||
call test_01('timestamp(6)', 'myisam', 'sys_start');
|
call test_01();
|
||||||
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)');
|
|
||||||
x y
|
x y
|
||||||
0 100
|
0 100
|
||||||
1 101
|
1 101
|
||||||
@ -318,40 +290,7 @@ BETWAND2_ext_x y
|
|||||||
8 108
|
8 108
|
||||||
9 109
|
9 109
|
||||||
3 33
|
3 33
|
||||||
call test_02('timestamp(6)', 'myisam', 'sys_start');
|
call test_02();
|
||||||
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)');
|
|
||||||
IJ1_x1 y1 x2 y2
|
IJ1_x1 y1 x2 y2
|
||||||
1 1 1 2
|
1 1 1 2
|
||||||
1 2 1 2
|
1 2 1 2
|
||||||
@ -386,14 +325,7 @@ NULL NULL 2 1
|
|||||||
NULL NULL 3 1
|
NULL NULL 3 1
|
||||||
create table t1(
|
create table t1(
|
||||||
A int
|
A int
|
||||||
) with system versioning engine=myisam;
|
) with system versioning;
|
||||||
insert into t1 values(1);
|
|
||||||
select * from t1;
|
|
||||||
A
|
|
||||||
1
|
|
||||||
create or replace table t1(
|
|
||||||
A int
|
|
||||||
) with system versioning engine=innodb;
|
|
||||||
insert into t1 values(1);
|
insert into t1 values(1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
A
|
A
|
||||||
@ -435,15 +367,7 @@ for each row set @end = old.sys_trx_end;
|
|||||||
update t1 set a=2;
|
update t1 set a=2;
|
||||||
select @end;
|
select @end;
|
||||||
@end
|
@end
|
||||||
2038-01-19 03:14:07.000000
|
MAX_RESULT
|
||||||
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
|
|
||||||
create or replace table t1 (a int) with system versioning;
|
create or replace table t1 (a int) with system versioning;
|
||||||
create or replace table t2 (b int) with system versioning;
|
create or replace table t2 (b int) with system versioning;
|
||||||
insert into t1 values (1);
|
insert into t1 values (1);
|
||||||
@ -467,7 +391,7 @@ a1 a2
|
|||||||
1 2
|
1 2
|
||||||
2 2
|
2 2
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
call verify_vtq;
|
call innodb_verify_vtq(19);
|
||||||
No A B C D
|
No A B C D
|
||||||
1 1 1 1 1
|
1 1 1 1 1
|
||||||
2 1 1 1 1
|
2 1 1 1 1
|
||||||
@ -480,6 +404,18 @@ No A B C D
|
|||||||
9 1 1 1 1
|
9 1 1 1 1
|
||||||
10 1 1 1 1
|
10 1 1 1 1
|
||||||
11 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_01;
|
||||||
drop procedure test_02;
|
drop procedure test_02;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -15,6 +15,51 @@ select ifnull(max(trx_id), 0)
|
|||||||
into @start_trx_id
|
into @start_trx_id
|
||||||
from information_schema.innodb_vtq;
|
from information_schema.innodb_vtq;
|
||||||
end~~
|
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(
|
create procedure test_01(
|
||||||
sys_type varchar(255),
|
sys_type varchar(255),
|
||||||
engine varchar(255),
|
engine varchar(255),
|
||||||
@ -528,3 +573,7 @@ drop procedure test_05;
|
|||||||
drop procedure test_06;
|
drop procedure test_06;
|
||||||
drop procedure test_07;
|
drop procedure test_07;
|
||||||
drop procedure verify_vtq;
|
drop procedure verify_vtq;
|
||||||
|
drop procedure innodb_verify_vtq;
|
||||||
|
drop function default_engine;
|
||||||
|
drop function sys_commit_ts;
|
||||||
|
drop function sys_datatype;
|
||||||
|
@ -204,4 +204,5 @@ select * from t;
|
|||||||
|
|
||||||
call verify_vtq;
|
call verify_vtq;
|
||||||
drop table t;
|
drop table t;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -64,5 +64,5 @@ call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
|
|||||||
call verify_vtq;
|
call verify_vtq;
|
||||||
|
|
||||||
drop procedure test_01;
|
drop procedure test_01;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -6,7 +6,6 @@ with system versioning
|
|||||||
engine innodb;
|
engine innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# VTQ_ISO_LEVEL #
|
# VTQ_ISO_LEVEL #
|
||||||
|
|
||||||
set transaction isolation level read uncommitted;
|
set transaction isolation level read uncommitted;
|
||||||
@ -76,4 +75,5 @@ select
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
call verify_vtq;
|
call verify_vtq;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -117,4 +117,5 @@ call verify_vtq;
|
|||||||
drop procedure test_01;
|
drop procedure test_01;
|
||||||
drop procedure test_02;
|
drop procedure test_02;
|
||||||
drop procedure test_03;
|
drop procedure test_03;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -193,4 +193,5 @@ drop procedure test_02;
|
|||||||
drop procedure test_03;
|
drop procedure test_03;
|
||||||
drop procedure test_04;
|
drop procedure test_04;
|
||||||
drop procedure test_05;
|
drop procedure test_05;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
5
mysql-test/suite/versioning/t/select.combinations
Normal file
5
mysql-test/suite/versioning/t/select.combinations
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[innodb]
|
||||||
|
default-storage-engine=innodb
|
||||||
|
|
||||||
|
[myisam]
|
||||||
|
default-storage-engine=myisam
|
@ -1,11 +1,12 @@
|
|||||||
-- source suite/versioning/common.inc
|
-- source suite/versioning/common.inc
|
||||||
|
|
||||||
delimiter ~~;
|
delimiter ~~;
|
||||||
create procedure test_01(
|
create procedure test_01()
|
||||||
sys_type varchar(255),
|
|
||||||
engine varchar(255),
|
|
||||||
fields varchar(255))
|
|
||||||
begin
|
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('
|
set @str= concat('
|
||||||
create table t1(
|
create table t1(
|
||||||
x int unsigned,
|
x int unsigned,
|
||||||
@ -56,16 +57,23 @@ begin
|
|||||||
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and 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 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 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;
|
end if;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
end~~
|
end~~
|
||||||
|
|
||||||
create or replace procedure test_02(
|
create or replace procedure test_02()
|
||||||
sys_type varchar(255),
|
|
||||||
engine varchar(255),
|
|
||||||
fields varchar(255))
|
|
||||||
begin
|
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('(
|
set @str0= concat('(
|
||||||
x int,
|
x int,
|
||||||
y int,
|
y int,
|
||||||
@ -102,22 +110,13 @@ begin
|
|||||||
end~~
|
end~~
|
||||||
delimiter ;~~
|
delimiter ;~~
|
||||||
|
|
||||||
call test_01('timestamp(6)', 'myisam', 'sys_start');
|
call test_01();
|
||||||
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
|
call test_02();
|
||||||
|
|
||||||
call test_02('timestamp(6)', 'myisam', 'sys_start');
|
|
||||||
call test_02('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
|
|
||||||
|
|
||||||
# wildcard expansion on hidden fields.
|
# wildcard expansion on hidden fields.
|
||||||
create table t1(
|
create table t1(
|
||||||
A int
|
A int
|
||||||
) with system versioning engine=myisam;
|
) with system versioning;
|
||||||
insert into t1 values(1);
|
|
||||||
select * from t1;
|
|
||||||
|
|
||||||
create or replace table t1(
|
|
||||||
A int
|
|
||||||
) with system versioning engine=innodb;
|
|
||||||
insert into t1 values(1);
|
insert into t1 values(1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
|
|
||||||
@ -151,20 +150,13 @@ drop view vt1;
|
|||||||
create or replace table t1(x int) with system versioning;
|
create or replace table t1(x int) with system versioning;
|
||||||
select * from (t1 as r left join t1 as u using (x)), t1;
|
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;
|
create or replace table t1 (a int) with system versioning;
|
||||||
insert into t1 values (1);
|
insert into t1 values (1);
|
||||||
create trigger read_end after update on t1
|
create trigger read_end after update on t1
|
||||||
for each row set @end = old.sys_trx_end;
|
for each row set @end = old.sys_trx_end;
|
||||||
update t1 set a=2;
|
update t1 set a=2;
|
||||||
select @end;
|
--replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.000000" MAX_RESULT
|
||||||
|
|
||||||
# @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;
|
|
||||||
select @end;
|
select @end;
|
||||||
|
|
||||||
create or replace table t1 (a int) with system versioning;
|
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;
|
drop table t1, t2;
|
||||||
|
|
||||||
call verify_vtq;
|
call innodb_verify_vtq(19);
|
||||||
|
|
||||||
drop procedure test_01;
|
drop procedure test_01;
|
||||||
drop procedure test_02;
|
drop procedure test_02;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -263,4 +263,5 @@ drop procedure test_04;
|
|||||||
drop procedure test_05;
|
drop procedure test_05;
|
||||||
drop procedure test_06;
|
drop procedure test_06;
|
||||||
drop procedure test_07;
|
drop procedure test_07;
|
||||||
drop procedure verify_vtq;
|
|
||||||
|
-- source suite/versioning/common_finish.inc
|
||||||
|
Reference in New Issue
Block a user