diff options
18 files changed, 486 insertions, 186 deletions
diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index 6723395f92f..9e26903c03b 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -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 ;~~ diff --git a/mysql-test/suite/versioning/common.opt b/mysql-test/suite/versioning/common.opt index 32a25eea24f..c108024a0bd 100644 --- a/mysql-test/suite/versioning/common.opt +++ b/mysql-test/suite/versioning/common.opt @@ -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 diff --git a/mysql-test/suite/versioning/common_finish.inc b/mysql-test/suite/versioning/common_finish.inc new file mode 100644 index 00000000000..0dbe07085c9 --- /dev/null +++ b/mysql-test/suite/versioning/common_finish.inc @@ -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; diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 7b0523d4e96..598aa6b98a8 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -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; diff --git a/mysql-test/suite/versioning/r/auto_increment.result b/mysql-test/suite/versioning/r/auto_increment.result index 81222963826..ae06e9348bf 100644 --- a/mysql-test/suite/versioning/r/auto_increment.result +++ b/mysql-test/suite/versioning/r/auto_increment.result @@ -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; diff --git a/mysql-test/suite/versioning/r/commit_id.result b/mysql-test/suite/versioning/r/commit_id.result index bb70b239fa0..9a41c0f3eb1 100644 --- a/mysql-test/suite/versioning/r/commit_id.result +++ b/mysql-test/suite/versioning/r/commit_id.result @@ -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; diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result index e8e7ba34919..784a0a8ad0c 100644 --- a/mysql-test/suite/versioning/r/delete.result +++ b/mysql-test/suite/versioning/r/delete.result @@ -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; diff --git a/mysql-test/suite/versioning/r/insert.result b/mysql-test/suite/versioning/r/insert.result index cd89083480a..8619ce3a916 100644 --- a/mysql-test/suite/versioning/r/insert.result +++ b/mysql-test/suite/versioning/r/insert.result @@ -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; diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result index 9dc32249692..86a56fe05a0 100644 --- a/mysql-test/suite/versioning/r/select.result +++ b/mysql-test/suite/versioning/r/select.result @@ -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; diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index 19820660146..0b998dde300 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -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; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index da780f6ca55..b6ffb41f33b 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -204,4 +204,5 @@ select * from t; call verify_vtq; drop table t; -drop procedure verify_vtq; + +-- source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/auto_increment.test b/mysql-test/suite/versioning/t/auto_increment.test index ee5cb9411d0..7b79be575d1 100644 --- a/mysql-test/suite/versioning/t/auto_increment.test +++ b/mysql-test/suite/versioning/t/auto_increment.test @@ -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 diff --git a/mysql-test/suite/versioning/t/commit_id.test b/mysql-test/suite/versioning/t/commit_id.test index 9f06e8a5b50..7f7886f07a5 100644 --- a/mysql-test/suite/versioning/t/commit_id.test +++ b/mysql-test/suite/versioning/t/commit_id.test @@ -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 diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index 320efd29d56..1830f512b88 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -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 diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index 2ed44d3ec98..730c5478841 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -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 diff --git a/mysql-test/suite/versioning/t/select.combinations b/mysql-test/suite/versioning/t/select.combinations new file mode 100644 index 00000000000..75fb20d9f5e --- /dev/null +++ b/mysql-test/suite/versioning/t/select.combinations @@ -0,0 +1,5 @@ +[innodb] +default-storage-engine=innodb + +[myisam] +default-storage-engine=myisam diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test index a535cd67e07..115706f9130 100644 --- a/mysql-test/suite/versioning/t/select.test +++ b/mysql-test/suite/versioning/t/select.test @@ -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 diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 861e5dd66eb..bec4aef208c 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -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 |