Commit fe10bf87 authored by Eugene Kosov's avatar Eugene Kosov Committed by Sergei Golubchik

MDEV-15893 Rename VTQ to TRT

parent a4272bf1
...@@ -6,7 +6,7 @@ select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_ ...@@ -6,7 +6,7 @@ select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_
set @test_start=now(6); set @test_start=now(6);
delimiter ~~; delimiter ~~;
create procedure if not exists verify_vtq() create procedure if not exists verify_trt()
begin begin
set @i= 0; set @i= 0;
select select
...@@ -22,7 +22,7 @@ begin ...@@ -22,7 +22,7 @@ begin
from mysql.transaction_registry; from mysql.transaction_registry;
end~~ end~~
create procedure if not exists verify_vtq_dummy(recs int) create procedure if not exists verify_trt_dummy(recs int)
begin begin
declare i int default 1; declare i int default 1;
create temporary table tmp (No int, A bool, B bool, C bool, D bool); create temporary table tmp (No int, A bool, B bool, C bool, D bool);
......
--disable_query_log --disable_query_log
drop procedure verify_vtq; drop procedure verify_trt;
drop procedure verify_vtq_dummy; drop procedure verify_trt_dummy;
drop function current_row; drop function current_row;
drop function check_row; drop function check_row;
--enable_query_log --enable_query_log
...@@ -265,14 +265,14 @@ t CREATE TABLE `t` ( ...@@ -265,14 +265,14 @@ t CREATE TABLE `t` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t drop system versioning; alter table t drop system versioning;
insert into t values(1); insert into t values(1);
call verify_vtq; call verify_trt;
No A B C D No A B C D
alter table t alter table t
add column trx_start bigint(20) unsigned as row start invisible, add column trx_start bigint(20) unsigned as row start invisible,
add column trx_end bigint(20) unsigned as row end invisible, add column trx_end bigint(20) unsigned as row end invisible,
add period for system_time(trx_start, trx_end), add period for system_time(trx_start, trx_end),
add system versioning; add system versioning;
call verify_vtq; call verify_trt;
No A B C D No A B C D
1 1 1 1 1 1 1 1 1 1
show create table t; show create table t;
...@@ -284,13 +284,13 @@ t CREATE TABLE `t` ( ...@@ -284,13 +284,13 @@ t CREATE TABLE `t` (
PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`) PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t drop column trx_start, drop column trx_end; alter table t drop column trx_start, drop column trx_end;
call verify_vtq; call verify_trt;
No A B C D No A B C D
alter table t drop system versioning, algorithm=copy; alter table t drop system versioning, algorithm=copy;
call verify_vtq; call verify_trt;
No A B C D No A B C D
alter table t add system versioning, algorithm=copy; alter table t add system versioning, algorithm=copy;
call verify_vtq; call verify_trt;
No A B C D No A B C D
show create table t; show create table t;
Table Create Table Table Create Table
...@@ -312,7 +312,7 @@ t CREATE TABLE `t` ( ...@@ -312,7 +312,7 @@ t CREATE TABLE `t` (
select * from t; select * from t;
a b a b
2 NULL 2 NULL
call verify_vtq; call verify_trt;
No A B C D No A B C D
alter table t drop column b, algorithm=copy; alter table t drop column b, algorithm=copy;
show create table t; show create table t;
...@@ -324,7 +324,7 @@ select * from t for system_time all; ...@@ -324,7 +324,7 @@ select * from t for system_time all;
a a
2 2
1 1
call verify_vtq; call verify_trt;
No A B C D No A B C D
alter table t drop system versioning, algorithm=copy; alter table t drop system versioning, algorithm=copy;
show create table t; show create table t;
...@@ -332,7 +332,7 @@ Table Create Table ...@@ -332,7 +332,7 @@ Table Create Table
t CREATE TABLE `t` ( t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
call verify_vtq; call verify_trt;
No A B C D No A B C D
create or replace table t (a int); create or replace table t (a int);
insert t values (1),(2),(3),(4); insert t values (1),(2),(3),(4);
......
...@@ -30,38 +30,38 @@ transaction_id = @tx2 ...@@ -30,38 +30,38 @@ transaction_id = @tx2
1 1
set @ts3= now(6); set @ts3= now(6);
select select
vtq_trx_id(@ts0) < @tx0 as A, trt_trx_id(@ts0) < @tx0 as A,
vtq_trx_id(@ts0, true) = @tx0 as B, trt_trx_id(@ts0, true) = @tx0 as B,
vtq_trx_id(@ts1) = @tx0 as C, trt_trx_id(@ts1) = @tx0 as C,
vtq_trx_id(@ts1, true) = @tx1 as D, trt_trx_id(@ts1, true) = @tx1 as D,
vtq_trx_id(@ts2) = @tx1 as E, trt_trx_id(@ts2) = @tx1 as E,
vtq_trx_id(@ts2, true) = @tx2 as F, trt_trx_id(@ts2, true) = @tx2 as F,
vtq_trx_id(@ts3) = @tx2 as G, trt_trx_id(@ts3) = @tx2 as G,
vtq_trx_id(@ts3, true) is null as H; trt_trx_id(@ts3, true) is null as H;
A B C D E F G H A B C D E F G H
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
select select
vtq_commit_id(@ts0) < @tx0 as A, trt_commit_id(@ts0) < @tx0 as A,
vtq_commit_id(@ts0, true) = vtq_commit_id(null, @tx0) as B, trt_commit_id(@ts0, true) = trt_commit_id(null, @tx0) as B,
vtq_commit_id(@ts1) = vtq_commit_id(null, @tx0) as C, trt_commit_id(@ts1) = trt_commit_id(null, @tx0) as C,
vtq_commit_id(@ts1, true) = vtq_commit_id(null, @tx1) as D, trt_commit_id(@ts1, true) = trt_commit_id(null, @tx1) as D,
vtq_commit_id(@ts2) = vtq_commit_id(null, @tx1) as E, trt_commit_id(@ts2) = trt_commit_id(null, @tx1) as E,
vtq_commit_id(@ts2, true) = vtq_commit_id(null, @tx2) as F, trt_commit_id(@ts2, true) = trt_commit_id(null, @tx2) as F,
vtq_commit_id(@ts3) = vtq_commit_id(null, @tx2) as G, trt_commit_id(@ts3) = trt_commit_id(null, @tx2) as G,
vtq_commit_id(@ts3, true) is null as H; trt_commit_id(@ts3, true) is null as H;
A B C D E F G H A B C D E F G H
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
select select
vtq_trx_sees(@tx1, @tx0) as A, trt_trx_sees(@tx1, @tx0) as A,
not vtq_trx_sees(@tx0, @tx1) as B, not trt_trx_sees(@tx0, @tx1) as B,
vtq_trx_sees_eq(@tx1, @tx1) as C, trt_trx_sees_eq(@tx1, @tx1) as C,
not vtq_trx_sees(@tx1, @tx1) as D, not trt_trx_sees(@tx1, @tx1) as D,
vtq_trx_sees(@tx2, 0) as E, trt_trx_sees(@tx2, 0) as E,
vtq_trx_sees(-1, @tx2) as F; trt_trx_sees(-1, @tx2) as F;
A B C D E F A B C D E F
1 1 1 1 1 1 1 1 1 1 1 1
select vtq_trx_sees(0, @tx2); select trt_trx_sees(0, @tx2);
vtq_trx_sees(0, @tx2) trt_trx_sees(0, @tx2)
NULL NULL
set transaction isolation level read uncommitted; set transaction isolation level read uncommitted;
insert into t1 values (); insert into t1 values ();
...@@ -88,7 +88,7 @@ select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where ...@@ -88,7 +88,7 @@ select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where
isolation_level = 'REPEATABLE-READ' isolation_level = 'REPEATABLE-READ'
1 1
drop table t1; drop table t1;
call verify_vtq; call verify_trt;
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
......
...@@ -512,7 +512,7 @@ Warnings: ...@@ -512,7 +512,7 @@ Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` FOR SYSTEM_TIME ALL on(`test`.`t4`.`f4` = `test`.`t2`.`f2` and `test`.`t4`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t3`.`f3` = `test`.`t2`.`f2`) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` FOR SYSTEM_TIME ALL on(`test`.`t4`.`f4` = `test`.`t2`.`f2` and `test`.`t4`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t3`.`f3` = `test`.`t2`.`f2`) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999'
drop view v1; drop view v1;
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
call verify_vtq_dummy(34); call verify_trt_dummy(34);
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
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
insert into t1(x, y) values(3, 33); insert into t1(x, y) values(3, 33);
select sys_start from t1 where x = 3 and y = 33 into @t1; select sys_start from t1 where x = 3 and y = 33 into @t1;
+set @x1= @t1; +set @x1= @t1;
+select vtq_commit_ts(@x1) into @t1; +select trt_commit_ts(@x1) into @t1;
select x, y from t1; select x, y from t1;
x y x y
0 100 0 100
......
...@@ -172,23 +172,23 @@ alter table t drop system versioning; ...@@ -172,23 +172,23 @@ alter table t drop system versioning;
insert into t values(1); insert into t values(1);
call verify_vtq; call verify_trt;
alter table t alter table t
add column trx_start bigint(20) unsigned as row start invisible, add column trx_start bigint(20) unsigned as row start invisible,
add column trx_end bigint(20) unsigned as row end invisible, add column trx_end bigint(20) unsigned as row end invisible,
add period for system_time(trx_start, trx_end), add period for system_time(trx_start, trx_end),
add system versioning; add system versioning;
call verify_vtq; call verify_trt;
show create table t; show create table t;
alter table t drop column trx_start, drop column trx_end; alter table t drop column trx_start, drop column trx_end;
call verify_vtq; call verify_trt;
alter table t drop system versioning, algorithm=copy; alter table t drop system versioning, algorithm=copy;
call verify_vtq; call verify_trt;
alter table t add system versioning, algorithm=copy; alter table t add system versioning, algorithm=copy;
call verify_vtq; call verify_trt;
show create table t; show create table t;
...@@ -198,31 +198,31 @@ select * from t for system_time all; ...@@ -198,31 +198,31 @@ select * from t for system_time all;
alter table t add column b int, algorithm=copy; alter table t add column b int, algorithm=copy;
show create table t; show create table t;
select * from t; select * from t;
call verify_vtq; call verify_trt;
alter table t drop column b, algorithm=copy; alter table t drop column b, algorithm=copy;
show create table t; show create table t;
select * from t for system_time all; select * from t for system_time all;
call verify_vtq; call verify_trt;
## FIXME: #414 IB: inplace for VERS_TIMESTAMP versioning ## FIXME: #414 IB: inplace for VERS_TIMESTAMP versioning
if (0) if (0)
{ {
alter table t drop system versioning, algorithm=inplace; alter table t drop system versioning, algorithm=inplace;
call verify_vtq; call verify_trt;
alter table t add system versioning, algorithm=inplace; alter table t add system versioning, algorithm=inplace;
call verify_vtq; call verify_trt;
show create table t; show create table t;
update t set a= 1; update t set a= 1;
select * from t for system_time all; select * from t for system_time all;
call verify_vtq; call verify_trt;
alter table t add column b int, algorithm=inplace; alter table t add column b int, algorithm=inplace;
show create table t; show create table t;
select * from t; select * from t;
call verify_vtq; call verify_trt;
alter table t drop column b, algorithm=inplace; alter table t drop column b, algorithm=inplace;
show create table t; show create table t;
...@@ -232,7 +232,7 @@ select * from t for system_time all; ...@@ -232,7 +232,7 @@ select * from t for system_time all;
alter table t drop system versioning, algorithm=copy; alter table t drop system versioning, algorithm=copy;
show create table t; show create table t;
call verify_vtq; call verify_trt;
# nullable autoinc test w/o versioning # nullable autoinc test w/o versioning
create or replace table t (a int); create or replace table t (a int);
...@@ -341,7 +341,7 @@ select * from t; ...@@ -341,7 +341,7 @@ select * from t;
show create table t; show create table t;
call verify_vtq; call verify_trt;
} }
create or replace table t (a int) with system versioning; create or replace table t (a int) with system versioning;
......
...@@ -10,7 +10,7 @@ with system versioning ...@@ -10,7 +10,7 @@ with system versioning
engine innodb; engine innodb;
# VTQ_TRX_ID, VTQ_COMMIT_ID, VTQ_TRX_SEES # # TRT_TRX_ID, TRT_COMMIT_ID, TRT_TRX_SEES #
insert into t1 values (); insert into t1 values ();
...@@ -36,36 +36,36 @@ order by transaction_id desc limit 1; ...@@ -36,36 +36,36 @@ order by transaction_id desc limit 1;
set @ts3= now(6); set @ts3= now(6);
select select
vtq_trx_id(@ts0) < @tx0 as A, trt_trx_id(@ts0) < @tx0 as A,
vtq_trx_id(@ts0, true) = @tx0 as B, trt_trx_id(@ts0, true) = @tx0 as B,
vtq_trx_id(@ts1) = @tx0 as C, trt_trx_id(@ts1) = @tx0 as C,
vtq_trx_id(@ts1, true) = @tx1 as D, trt_trx_id(@ts1, true) = @tx1 as D,
vtq_trx_id(@ts2) = @tx1 as E, trt_trx_id(@ts2) = @tx1 as E,
vtq_trx_id(@ts2, true) = @tx2 as F, trt_trx_id(@ts2, true) = @tx2 as F,
vtq_trx_id(@ts3) = @tx2 as G, trt_trx_id(@ts3) = @tx2 as G,
vtq_trx_id(@ts3, true) is null as H; trt_trx_id(@ts3, true) is null as H;
select select
vtq_commit_id(@ts0) < @tx0 as A, trt_commit_id(@ts0) < @tx0 as A,
vtq_commit_id(@ts0, true) = vtq_commit_id(null, @tx0) as B, trt_commit_id(@ts0, true) = trt_commit_id(null, @tx0) as B,
vtq_commit_id(@ts1) = vtq_commit_id(null, @tx0) as C, trt_commit_id(@ts1) = trt_commit_id(null, @tx0) as C,
vtq_commit_id(@ts1, true) = vtq_commit_id(null, @tx1) as D, trt_commit_id(@ts1, true) = trt_commit_id(null, @tx1) as D,
vtq_commit_id(@ts2) = vtq_commit_id(null, @tx1) as E, trt_commit_id(@ts2) = trt_commit_id(null, @tx1) as E,
vtq_commit_id(@ts2, true) = vtq_commit_id(null, @tx2) as F, trt_commit_id(@ts2, true) = trt_commit_id(null, @tx2) as F,
vtq_commit_id(@ts3) = vtq_commit_id(null, @tx2) as G, trt_commit_id(@ts3) = trt_commit_id(null, @tx2) as G,
vtq_commit_id(@ts3, true) is null as H; trt_commit_id(@ts3, true) is null as H;
select select
vtq_trx_sees(@tx1, @tx0) as A, trt_trx_sees(@tx1, @tx0) as A,
not vtq_trx_sees(@tx0, @tx1) as B, not trt_trx_sees(@tx0, @tx1) as B,
vtq_trx_sees_eq(@tx1, @tx1) as C, trt_trx_sees_eq(@tx1, @tx1) as C,
not vtq_trx_sees(@tx1, @tx1) as D, not trt_trx_sees(@tx1, @tx1) as D,
vtq_trx_sees(@tx2, 0) as E, trt_trx_sees(@tx2, 0) as E,
vtq_trx_sees(-1, @tx2) as F; trt_trx_sees(-1, @tx2) as F;
select vtq_trx_sees(0, @tx2); select trt_trx_sees(0, @tx2);
# VTQ_ISO_LEVEL # # TRT_ISO_LEVEL #
set transaction isolation level read uncommitted; set transaction isolation level read uncommitted;
insert into t1 values (); insert into t1 values ();
...@@ -89,6 +89,6 @@ select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where ...@@ -89,6 +89,6 @@ select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where
drop table t1; drop table t1;
call verify_vtq; call verify_trt;
-- source suite/versioning/common_finish.inc -- source suite/versioning/common_finish.inc
--source include/have_innodb.inc --source include/have_innodb.inc
# VTQ test # TRT test
create table t1( create table t1(
x int unsigned, x int unsigned,
......
...@@ -41,7 +41,7 @@ if ($MTR_COMBINATION_TRX_ID) ...@@ -41,7 +41,7 @@ if ($MTR_COMBINATION_TRX_ID)
{ {
--disable_query_log --disable_query_log
set @x1= @t1; set @x1= @t1;
select vtq_commit_ts(@x1) into @t1; select trt_commit_ts(@x1) into @t1;
--enable_query_log --enable_query_log
} }
...@@ -326,6 +326,6 @@ select f1 from t1 join t2 left join t3 left join t4 on f3 = f4 on f3 = f2; ...@@ -326,6 +326,6 @@ select f1 from t1 join t2 left join t3 left join t4 on f3 = f4 on f3 = f2;
drop view v1; drop view v1;
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
call verify_vtq_dummy(34); call verify_trt_dummy(34);
-- source suite/versioning/common_finish.inc -- source suite/versioning/common_finish.inc
...@@ -31,7 +31,7 @@ insert into t1(x, y) values(3, 33); ...@@ -31,7 +31,7 @@ insert into t1(x, y) values(3, 33);
select sys_start from t1 where x = 3 and y = 33 into @t1; select sys_start from t1 where x = 3 and y = 33 into @t1;
if($MTR_COMBINATION_TRX_ID) { if($MTR_COMBINATION_TRX_ID) {
set @x1= @t1; set @x1= @t1;
select vtq_commit_ts(@x1) into @t1; select trt_commit_ts(@x1) into @t1;
} }
select x, y from t1; select x, y from t1;
......
...@@ -24,26 +24,26 @@ ...@@ -24,26 +24,26 @@
#include "item.h" #include "item.h"
#include "vers_utils.h" #include "vers_utils.h"
/* System Versioning: VTQ_TRX_ID(), VTQ_COMMIT_ID(), VTQ_BEGIN_TS(), VTQ_COMMIT_TS(), VTQ_ISO_LEVEL() */ /* System Versioning: TRT_TRX_ID(), TRT_COMMIT_ID(), TRT_BEGIN_TS(), TRT_COMMIT_TS(), TRT_ISO_LEVEL() */
template <TR_table::field_id_t VTQ_FIELD> template <TR_table::field_id_t TRT_FIELD>
class Create_func_vtq : public Create_native_func class Create_func_trt : public Create_native_func
{ {
public: public:
virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
static Create_func_vtq<VTQ_FIELD> s_singleton; static Create_func_trt<TRT_FIELD> s_singleton;
protected: protected:
Create_func_vtq<VTQ_FIELD>() {} Create_func_trt<TRT_FIELD>() {}
virtual ~Create_func_vtq<VTQ_FIELD>() {} virtual ~Create_func_trt<TRT_FIELD>() {}
}; };
template<TR_table::field_id_t VTQ_FIELD> template<TR_table::field_id_t TRT_FIELD>
Create_func_vtq<VTQ_FIELD> Create_func_vtq<VTQ_FIELD>::s_singleton; Create_func_trt<TRT_FIELD> Create_func_trt<TRT_FIELD>::s_singleton;
template <TR_table::field_id_t VTQ_FIELD> template <TR_table::field_id_t TRT_FIELD>
Item* Item*
Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name, Create_func_trt<TRT_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
List<Item> *item_list) List<Item> *item_list)
{ {
Item *func= NULL; Item *func= NULL;
...@@ -56,16 +56,16 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name, ...@@ -56,16 +56,16 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
case 1: case 1:
{ {
Item *param_1= item_list->pop(); Item *param_1= item_list->pop();
switch (VTQ_FIELD) switch (TRT_FIELD)
{ {
case TR_table::FLD_BEGIN_TS: case TR_table::FLD_BEGIN_TS:
case TR_table::FLD_COMMIT_TS: case TR_table::FLD_COMMIT_TS:
func= new (thd->mem_root) Item_func_vtq_ts(thd, param_1, VTQ_FIELD); func= new (thd->mem_root) Item_func_trt_ts(thd, param_1, TRT_FIELD);
break; break;
case TR_table::FLD_TRX_ID: case TR_table::FLD_TRX_ID:
case TR_table::FLD_COMMIT_ID: case TR_table::FLD_COMMIT_ID:
case TR_table::FLD_ISO_LEVEL: case TR_table::FLD_ISO_LEVEL:
func= new (thd->mem_root) Item_func_vtq_id(thd, param_1, VTQ_FIELD); func= new (thd->mem_root) Item_func_trt_id(thd, param_1, TRT_FIELD);
break; break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
...@@ -76,11 +76,11 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name, ...@@ -76,11 +76,11 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
{ {
Item *param_1= item_list->pop(); Item *param_1= item_list->pop();
Item *param_2= item_list->pop(); Item *param_2= item_list->pop();
switch (VTQ_FIELD) switch (TRT_FIELD)
{ {
case TR_table::FLD_TRX_ID: case TR_table::FLD_TRX_ID:
case TR_table::FLD_COMMIT_ID: case TR_table::FLD_COMMIT_ID:
func= new (thd->mem_root) Item_func_vtq_id(thd, param_1, param_2, VTQ_FIELD); func= new (thd->mem_root) Item_func_trt_id(thd, param_1, param_2, TRT_FIELD);
break; break;
default: default:
goto error; goto error;
...@@ -98,8 +98,8 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name, ...@@ -98,8 +98,8 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
return func; return func;
}; };
template <class Item_func_vtq_trx_seesX> template <class Item_func_trt_trx_seesX>
class Create_func_vtq_trx_sees : public Create_native_func class Create_func_trt_trx_sees : public Create_native_func
{ {
public: public:
virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list) virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
...@@ -115,7 +115,7 @@ class Create_func_vtq_trx_sees : public Create_native_func ...@@ -115,7 +115,7 @@ class Create_func_vtq_trx_sees : public Create_native_func
{ {
Item *param_1= item_list->pop(); Item *param_1= item_list->pop();
Item *param_2= item_list->pop(); Item *param_2= item_list->pop();
func= new (thd->mem_root) Item_func_vtq_trx_seesX(thd, param_1, param_2); func= new (thd->mem_root) Item_func_trt_trx_seesX(thd, param_1, param_2);
break; break;
} }
default: default:
...@@ -126,27 +126,27 @@ class Create_func_vtq_trx_sees : public Create_native_func ...@@ -126,27 +126,27 @@ class Create_func_vtq_trx_sees : public Create_native_func
return func; return func;
} }
static Create_func_vtq_trx_sees<Item_func_vtq_trx_seesX> s_singleton; static Create_func_trt_trx_sees<Item_func_trt_trx_seesX> s_singleton;
protected: protected:
Create_func_vtq_trx_sees<Item_func_vtq_trx_seesX>() {} Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() {}
virtual ~Create_func_vtq_trx_sees<Item_func_vtq_trx_seesX>() {} virtual ~Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() {}
}; };
template<class X> template<class X>
Create_func_vtq_trx_sees<X> Create_func_vtq_trx_sees<X>::s_singleton; Create_func_trt_trx_sees<X> Create_func_trt_trx_sees<X>::s_singleton;
#define BUILDER(F) & F::s_singleton #define BUILDER(F) & F::s_singleton
static Native_func_registry func_array[] = static Native_func_registry func_array[] =
{ {
{ { C_STRING_WITH_LEN("VTQ_BEGIN_TS") }, BUILDER(Create_func_vtq<TR_table::FLD_BEGIN_TS>)}, { { C_STRING_WITH_LEN("TRT_BEGIN_TS") }, BUILDER(Create_func_trt<TR_table::FLD_BEGIN_TS>)},
{ { C_STRING_WITH_LEN("VTQ_COMMIT_ID") }, BUILDER(Create_func_vtq<TR_table::FLD_COMMIT_ID>)}, { { C_STRING_WITH_LEN("TRT_COMMIT_ID") }, BUILDER(Create_func_trt<TR_table::FLD_COMMIT_ID>)},
{ { C_STRING_WITH_LEN("VTQ_COMMIT_TS") }, BUILDER(Create_func_vtq<TR_table::FLD_COMMIT_TS>)}, { { C_STRING_WITH_LEN("TRT_COMMIT_TS") }, BUILDER(Create_func_trt<TR_table::FLD_COMMIT_TS>)},
{ { C_STRING_WITH_LEN("VTQ_ISO_LEVEL") }, BUILDER(Create_func_vtq<TR_table::FLD_ISO_LEVEL>)}, { { C_STRING_WITH_LEN("TRT_ISO_LEVEL") }, BUILDER(Create_func_trt<TR_table::FLD_ISO_LEVEL>)},
{ { C_STRING_WITH_LEN("VTQ_TRX_ID") }, BUILDER(Create_func_vtq<TR_table::FLD_TRX_ID>)}, { { C_STRING_WITH_LEN("TRT_TRX_ID") }, BUILDER(Create_func_trt<TR_table::FLD_TRX_ID>)},
{ { C_STRING_WITH_LEN("VTQ_TRX_SEES") }, BUILDER(Create_func_vtq_trx_sees<Item_func_vtq_trx_sees>)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES") }, BUILDER(Create_func_trt_trx_sees<Item_func_trt_trx_sees>)},
{ { C_STRING_WITH_LEN("VTQ_TRX_SEES_EQ") }, BUILDER(Create_func_vtq_trx_sees<Item_func_vtq_trx_sees_eq>)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES_EQ") }, BUILDER(Create_func_trt_trx_sees<Item_func_trt_trx_sees_eq>)},
{ {0, 0}, NULL} { {0, 0}, NULL}
}; };
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include "tztime.h" #include "tztime.h"
#include "item.h" #include "item.h"
Item_func_vtq_ts::Item_func_vtq_ts(THD *thd, Item* a, TR_table::field_id_t _vtq_field) : Item_func_trt_ts::Item_func_trt_ts(THD *thd, Item* a, TR_table::field_id_t _trt_field) :
Item_datetimefunc(thd, a), Item_datetimefunc(thd, a),
vtq_field(_vtq_field) trt_field(_trt_field)
{ {
decimals= 6; decimals= 6;
null_value= true; null_value= true;
...@@ -37,7 +37,7 @@ Item_func_vtq_ts::Item_func_vtq_ts(THD *thd, Item* a, TR_table::field_id_t _vtq_ ...@@ -37,7 +37,7 @@ Item_func_vtq_ts::Item_func_vtq_ts(THD *thd, Item* a, TR_table::field_id_t _vtq_
bool bool
Item_func_vtq_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date) Item_func_trt_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date)
{ {
THD *thd= current_thd; // can it differ from constructor's? THD *thd= current_thd; // can it differ from constructor's?
DBUG_ASSERT(thd); DBUG_ASSERT(thd);
...@@ -67,14 +67,14 @@ Item_func_vtq_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date) ...@@ -67,14 +67,14 @@ Item_func_vtq_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date)
return true; return true;
} }
return trt[vtq_field]->get_date(res, fuzzy_date); return trt[trt_field]->get_date(res, fuzzy_date);
} }
Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, TR_table::field_id_t _vtq_field, Item_func_trt_id::Item_func_trt_id(THD *thd, Item* a, TR_table::field_id_t _trt_field,
bool _backwards) : bool _backwards) :
Item_longlong_func(thd, a), Item_longlong_func(thd, a),
vtq_field(_vtq_field), trt_field(_trt_field),
backwards(_backwards) backwards(_backwards)
{ {
decimals= 0; decimals= 0;
...@@ -83,9 +83,9 @@ Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, TR_table::field_id_t _vtq_ ...@@ -83,9 +83,9 @@ Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, TR_table::field_id_t _vtq_
DBUG_ASSERT(arg_count == 1 && args[0]); DBUG_ASSERT(arg_count == 1 && args[0]);
} }
Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _vtq_field) : Item_func_trt_id::Item_func_trt_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _trt_field) :
Item_longlong_func(thd, a, b), Item_longlong_func(thd, a, b),
vtq_field(_vtq_field), trt_field(_trt_field),
backwards(false) backwards(false)
{ {
decimals= 0; decimals= 0;
...@@ -95,7 +95,7 @@ Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, Item* b, TR_table::field_i ...@@ -95,7 +95,7 @@ Item_func_vtq_id::Item_func_vtq_id(THD *thd, Item* a, Item* b, TR_table::field_i
} }
longlong longlong
Item_func_vtq_id::get_by_trx_id(ulonglong trx_id) Item_func_trt_id::get_by_trx_id(ulonglong trx_id)
{ {
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ASSERT(thd); DBUG_ASSERT(thd);
...@@ -111,11 +111,11 @@ Item_func_vtq_id::get_by_trx_id(ulonglong trx_id) ...@@ -111,11 +111,11 @@ Item_func_vtq_id::get_by_trx_id(ulonglong trx_id)
if (null_value) if (null_value)
return 0; return 0;
return trt[vtq_field]->val_int(); return trt[trt_field]->val_int();
} }
longlong longlong
Item_func_vtq_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards) Item_func_trt_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards)
{ {
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ASSERT(thd); DBUG_ASSERT(thd);
...@@ -125,15 +125,15 @@ Item_func_vtq_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards) ...@@ -125,15 +125,15 @@ Item_func_vtq_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards)
if (null_value) if (null_value)
return 0; return 0;
return trt[vtq_field]->val_int(); return trt[trt_field]->val_int();
} }
longlong longlong
Item_func_vtq_id::val_int() Item_func_trt_id::val_int()
{ {
if (args[0]->is_null()) if (args[0]->is_null())
{ {
if (arg_count < 2 || vtq_field == TR_table::FLD_TRX_ID) if (arg_count < 2 || trt_field == TR_table::FLD_TRX_ID)
{ {
null_value= true; null_value= true;
return 0; return 0;
...@@ -157,7 +157,7 @@ Item_func_vtq_id::val_int() ...@@ -157,7 +157,7 @@ Item_func_vtq_id::val_int()
} }
} }
Item_func_vtq_trx_sees::Item_func_vtq_trx_sees(THD *thd, Item* a, Item* b) : Item_func_trt_trx_sees::Item_func_trt_trx_sees(THD *thd, Item* a, Item* b) :
Item_bool_func(thd, a, b), Item_bool_func(thd, a, b),
accept_eq(false) accept_eq(false)
{ {
...@@ -166,7 +166,7 @@ Item_func_vtq_trx_sees::Item_func_vtq_trx_sees(THD *thd, Item* a, Item* b) : ...@@ -166,7 +166,7 @@ Item_func_vtq_trx_sees::Item_func_vtq_trx_sees(THD *thd, Item* a, Item* b) :
} }
longlong longlong
Item_func_vtq_trx_sees::val_int() Item_func_trt_trx_sees::val_int()
{ {
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ASSERT(thd); DBUG_ASSERT(thd);
......
...@@ -22,47 +22,47 @@ ...@@ -22,47 +22,47 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
class Item_func_vtq_ts: public Item_datetimefunc class Item_func_trt_ts: public Item_datetimefunc
{ {
TR_table::field_id_t vtq_field; TR_table::field_id_t trt_field;
public: public:
Item_func_vtq_ts(THD *thd, Item* a, TR_table::field_id_t _vtq_field); Item_func_trt_ts(THD *thd, Item* a, TR_table::field_id_t _trt_field);
const char *func_name() const const char *func_name() const
{ {
if (vtq_field == TR_table::FLD_BEGIN_TS) if (trt_field == TR_table::FLD_BEGIN_TS)
{ {
return "vtq_begin_ts"; return "trt_begin_ts";
} }
return "vtq_commit_ts"; return "trt_commit_ts";
} }
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_vtq_ts>(thd, this); } { return get_item_copy<Item_func_trt_ts>(thd, this); }
void fix_length_and_dec() { fix_attributes_datetime(decimals); } void fix_length_and_dec() { fix_attributes_datetime(decimals); }
}; };
class Item_func_vtq_id : public Item_longlong_func class Item_func_trt_id : public Item_longlong_func
{ {
TR_table::field_id_t vtq_field; TR_table::field_id_t trt_field;
bool backwards; bool backwards;
longlong get_by_trx_id(ulonglong trx_id); longlong get_by_trx_id(ulonglong trx_id);
longlong get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards); longlong get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards);
public: public:
Item_func_vtq_id(THD *thd, Item* a, TR_table::field_id_t _vtq_field, bool _backwards= false); Item_func_trt_id(THD *thd, Item* a, TR_table::field_id_t _trt_field, bool _backwards= false);
Item_func_vtq_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _vtq_field); Item_func_trt_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _trt_field);
const char *func_name() const const char *func_name() const
{ {
switch (vtq_field) switch (trt_field)
{ {
case TR_table::FLD_TRX_ID: case TR_table::FLD_TRX_ID:
return "vtq_trx_id"; return "trt_trx_id";
case TR_table::FLD_COMMIT_ID: case TR_table::FLD_COMMIT_ID:
return "vtq_commit_id"; return "trt_commit_id";
case TR_table::FLD_ISO_LEVEL: case TR_table::FLD_ISO_LEVEL:
return "vtq_iso_level"; return "trt_iso_level";
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
...@@ -77,37 +77,37 @@ class Item_func_vtq_id : public Item_longlong_func ...@@ -77,37 +77,37 @@ class Item_func_vtq_id : public Item_longlong_func
longlong val_int(); longlong val_int();
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_vtq_id>(thd, this); } { return get_item_copy<Item_func_trt_id>(thd, this); }
}; };
class Item_func_vtq_trx_sees : public Item_bool_func class Item_func_trt_trx_sees : public Item_bool_func
{ {
protected: protected:
bool accept_eq; bool accept_eq;
public: public:
Item_func_vtq_trx_sees(THD *thd, Item* a, Item* b); Item_func_trt_trx_sees(THD *thd, Item* a, Item* b);
const char *func_name() const const char *func_name() const
{ {
return "vtq_trx_sees"; return "trt_trx_sees";
} }
longlong val_int(); longlong val_int();
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_vtq_trx_sees>(thd, this); } { return get_item_copy<Item_func_trt_trx_sees>(thd, this); }
}; };
class Item_func_vtq_trx_sees_eq : class Item_func_trt_trx_sees_eq :
public Item_func_vtq_trx_sees public Item_func_trt_trx_sees
{ {
public: public:
Item_func_vtq_trx_sees_eq(THD *thd, Item* a, Item* b) : Item_func_trt_trx_sees_eq(THD *thd, Item* a, Item* b) :
Item_func_vtq_trx_sees(thd, a, b) Item_func_trt_trx_sees(thd, a, b)
{ {
accept_eq= true; accept_eq= true;
} }
const char *func_name() const const char *func_name() const
{ {
return "vtq_trx_sees_eq"; return "trt_trx_sees_eq";
} }
}; };
......
...@@ -901,27 +901,27 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables) ...@@ -901,27 +901,27 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
break; break;
case SYSTEM_TIME_AS_OF: case SYSTEM_TIME_AS_OF:
trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP
? newx Item_func_vtq_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID) ? newx Item_func_trt_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID)
: vers_conditions.start.item; : vers_conditions.start.item;
cond1= newx Item_func_vtq_trx_sees_eq(thd, trx_id0, row_start); cond1= newx Item_func_trt_trx_sees_eq(thd, trx_id0, row_start);
cond2= newx Item_func_vtq_trx_sees(thd, row_end, trx_id0); cond2= newx Item_func_trt_trx_sees(thd, row_end, trx_id0);
break; break;
case SYSTEM_TIME_FROM_TO: case SYSTEM_TIME_FROM_TO:
case SYSTEM_TIME_BETWEEN: case SYSTEM_TIME_BETWEEN:
trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP
? newx Item_func_vtq_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID, true) ? newx Item_func_trt_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID, true)
: vers_conditions.start.item; : vers_conditions.start.item;
trx_id1= vers_conditions.end.unit == VERS_TIMESTAMP trx_id1= vers_conditions.end.unit == VERS_TIMESTAMP
? newx Item_func_vtq_id(thd, vers_conditions.end.item, TR_table::FLD_TRX_ID, false) ? newx Item_func_trt_id(thd, vers_conditions.end.item, TR_table::FLD_TRX_ID, false)
: vers_conditions.end.item; : vers_conditions.end.item;
cond1= vers_conditions.type == SYSTEM_TIME_FROM_TO cond1= vers_conditions.type == SYSTEM_TIME_FROM_TO
? newx Item_func_vtq_trx_sees(thd, trx_id1, row_start) ? newx Item_func_trt_trx_sees(thd, trx_id1, row_start)
: newx Item_func_vtq_trx_sees_eq(thd, trx_id1, row_start); : newx Item_func_trt_trx_sees_eq(thd, trx_id1, row_start);
cond2= newx Item_func_vtq_trx_sees_eq(thd, row_end, trx_id0); cond2= newx Item_func_trt_trx_sees_eq(thd, row_end, trx_id0);
break; break;
case SYSTEM_TIME_BEFORE: case SYSTEM_TIME_BEFORE:
trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP trx_id0= vers_conditions.start.unit == VERS_TIMESTAMP
? newx Item_func_vtq_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID) ? newx Item_func_trt_id(thd, vers_conditions.start.item, TR_table::FLD_TRX_ID)
: vers_conditions.start.item; : vers_conditions.start.item;
cond1= newx Item_func_lt(thd, row_end, trx_id0); cond1= newx Item_func_lt(thd, row_end, trx_id0);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment