mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Timestamp-based versioning for InnoDB [closes #209]
* Removed integer_fields check * Reworked Vers_parse_info::check_sys_fields() * Misc renames * versioned as vers_sys_type_t * Removed versioned_by_sql(), versioned_by_engine() versioned() works as before; versioned(VERS_TIMESTAMP) is versioned_by_sql(); versioned(VERS_TRX_ID) is versioned_by_engine(). * create_tmp_table() fix * Foreign constraints for timestamp-based * Range auto-specifier fix * SQL: 1-row partition rotation fix [fixes #260] * Fix 'drop system versioning, algorithm=inplace'
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
|
||||
# test_01
|
||||
|
||||
create or replace table t1 (
|
||||
--replace_result $sys_datatype_expl SYS_DATATYPE
|
||||
eval create or replace table t1 (
|
||||
x int unsigned,
|
||||
y int unsigned
|
||||
y int unsigned,
|
||||
sys_trx_start $sys_datatype_expl generated always as row start,
|
||||
sys_trx_end $sys_datatype_expl generated always as row end,
|
||||
period for system_time (sys_trx_start, sys_trx_end)
|
||||
) with system versioning;
|
||||
|
||||
insert into t1 (x, y) values
|
||||
@@ -21,7 +25,7 @@ insert into t1 (x, y) values
|
||||
(9, 109);
|
||||
|
||||
set @t0= now(6);
|
||||
if ($default_engine == 'InnoDB')
|
||||
if ($MTR_COMBINATION_TRX_ID)
|
||||
{
|
||||
--disable_query_log
|
||||
select sys_trx_start from t1 limit 1 into @x0;
|
||||
@@ -33,7 +37,7 @@ delete from t1 where x > 7;
|
||||
|
||||
insert into t1(x, y) values(3, 33);
|
||||
select sys_trx_start from t1 where x = 3 and y = 33 into @t1;
|
||||
if ($default_engine == 'InnoDB')
|
||||
if ($MTR_COMBINATION_TRX_ID)
|
||||
{
|
||||
--disable_query_log
|
||||
set @x1= @t1;
|
||||
@@ -48,13 +52,13 @@ select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0'
|
||||
select x as ALL_x, y from t1 for system_time all;
|
||||
|
||||
--disable_query_log
|
||||
if ($default_engine == 'InnoDB')
|
||||
if ($MTR_COMBINATION_TRX_ID)
|
||||
{
|
||||
select x as ASOF2_x, y from t1 for system_time as of @x0;
|
||||
select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
|
||||
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
|
||||
}
|
||||
if ($default_engine != 'InnoDB')
|
||||
if ($MTR_COMBINATION_TIMESTAMP)
|
||||
{
|
||||
select x as ASOF2_x, y from t1 for system_time as of @t0;
|
||||
select x as FROMTO2_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
|
||||
@@ -196,7 +200,13 @@ for system_time all as t;
|
||||
create or replace table t1 (x int) with system versioning engine myisam;
|
||||
--error ER_VERS_ENGINE_UNSUPPORTED
|
||||
select * from t1 for system_time as of transaction 1;
|
||||
create or replace table t1 (x int) with system versioning engine innodb;
|
||||
|
||||
create or replace table t1 (
|
||||
x int,
|
||||
sys_trx_start bigint unsigned generated always as row start,
|
||||
sys_trx_end bigint unsigned generated always as row end,
|
||||
period for system_time (sys_trx_start, sys_trx_end)
|
||||
) with system versioning engine innodb;
|
||||
insert into t1 values (1);
|
||||
set @ts= now(6);
|
||||
delete from t1;
|
||||
@@ -206,19 +216,21 @@ select sys_trx_start from t1 for system_time all into @trx_start;
|
||||
select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good;
|
||||
|
||||
--echo ## TIMESTAMP specifier
|
||||
select * from t1 for system_time as of timestamp @ts;
|
||||
select * from t1 for system_time as of timestamp unix_timestamp(@ts);
|
||||
select * from t1 for system_time as of timestamp @trx_start;
|
||||
select x from t1 for system_time as of timestamp @ts;
|
||||
select x from t1 for system_time as of timestamp unix_timestamp(@ts);
|
||||
select x from t1 for system_time as of timestamp @trx_start;
|
||||
|
||||
set @ts= timestamp'1-1-1 0:0:0';
|
||||
|
||||
--echo ## TRANSACTION specifier
|
||||
select * from t1 for system_time as of transaction @ts;
|
||||
select * from t1 for system_time as of transaction unix_timestamp(@ts);
|
||||
select * from t1 for system_time as of transaction @trx_start;
|
||||
select x from t1 for system_time as of transaction @ts;
|
||||
select x from t1 for system_time as of transaction unix_timestamp(@ts);
|
||||
select x from t1 for system_time as of transaction @trx_start;
|
||||
|
||||
--echo ## no specifier (auto-detection)
|
||||
select * from t1 for system_time as of @ts;
|
||||
select * from t1 for system_time as of unix_timestamp(@ts);
|
||||
select * from t1 for system_time as of @trx_start;
|
||||
select x from t1 for system_time as of @ts;
|
||||
select x from t1 for system_time as of unix_timestamp(@ts);
|
||||
select x from t1 for system_time as of @trx_start;
|
||||
|
||||
|
||||
--echo ### Issue #365, bug 4 (related to #226, optimized fields)
|
||||
@@ -275,6 +287,6 @@ select * from t1 where t = '00:00:00' and i > 0 and sys_trx_end <> '2012-12-12 0
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
|
||||
call innodb_verify_vtq(34);
|
||||
call verify_vtq_dummy(34);
|
||||
|
||||
-- source suite/versioning/common_finish.inc
|
||||
|
||||
Reference in New Issue
Block a user