2017-12-03 21:06:24 +01:00
|
|
|
--disable_query_log
|
2017-12-03 22:07:33 +01:00
|
|
|
--source suite/versioning/innodb.inc
|
|
|
|
|
2016-10-18 11:05:49 +02:00
|
|
|
set @@session.time_zone='+00:00';
|
2017-11-10 15:54:46 +01:00
|
|
|
select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry;
|
2017-10-17 16:20:46 +02:00
|
|
|
set @test_start=now(6);
|
2016-10-18 11:05:49 +02:00
|
|
|
|
|
|
|
delimiter ~~;
|
|
|
|
create procedure if not exists verify_vtq()
|
|
|
|
begin
|
|
|
|
set @i= 0;
|
|
|
|
select
|
|
|
|
@i:= @i + 1 as No,
|
2017-07-04 11:05:40 +02:00
|
|
|
transaction_id > 0 as A,
|
|
|
|
commit_id > transaction_id as B,
|
2017-10-17 16:20:46 +02:00
|
|
|
begin_timestamp > @test_start as C,
|
2017-07-04 11:05:40 +02:00
|
|
|
commit_timestamp >= begin_timestamp as D
|
2017-11-10 15:54:46 +01:00
|
|
|
from mysql.transaction_registry
|
2017-07-04 11:05:40 +02:00
|
|
|
where transaction_id > @start_trx_id;
|
|
|
|
select ifnull(max(transaction_id), 0)
|
2016-10-18 11:05:49 +02:00
|
|
|
into @start_trx_id
|
2017-11-10 15:54:46 +01:00
|
|
|
from mysql.transaction_registry;
|
2016-10-18 11:05:49 +02:00
|
|
|
end~~
|
2017-03-15 16:36:54 +01:00
|
|
|
|
|
|
|
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~~
|
|
|
|
|
2017-12-04 10:36:07 +01:00
|
|
|
create function if not exists current_row(sys_trx_end varbinary(255))
|
|
|
|
returns int
|
|
|
|
deterministic
|
|
|
|
begin
|
|
|
|
if default_engine() = 'innodb' then
|
|
|
|
return sys_trx_end = 18446744073709551615;
|
|
|
|
elseif default_engine() = 'myisam' then
|
|
|
|
return sys_trx_end = timestamp'2038-01-19 03:14:07.999999';
|
|
|
|
end if;
|
|
|
|
return NULL;
|
|
|
|
end~~
|
|
|
|
|
2017-03-15 16:36:54 +01:00
|
|
|
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~~
|
2017-09-25 12:24:44 +02:00
|
|
|
|
|
|
|
create procedure concat_exec2(a varchar(255), b varchar(255))
|
|
|
|
begin
|
|
|
|
prepare stmt from concat(a, b);
|
|
|
|
execute stmt;
|
|
|
|
deallocate prepare stmt;
|
|
|
|
end~~
|
|
|
|
|
|
|
|
create procedure concat_exec3(a varchar(255), b varchar(255), c varchar(255))
|
|
|
|
begin
|
|
|
|
prepare stmt from concat(a, b, c);
|
|
|
|
execute stmt;
|
|
|
|
deallocate prepare stmt;
|
|
|
|
end~~
|
2016-10-18 11:05:49 +02:00
|
|
|
delimiter ;~~
|
2017-08-03 09:11:49 +02:00
|
|
|
|
|
|
|
let $default_engine= `select default_engine()`;
|
|
|
|
let sys_datatype= `select sys_datatype()`;
|
2017-12-03 21:06:24 +01:00
|
|
|
--enable_query_log
|