From d6b68b0e8db29fb3bd95fc7fd99a9cdbcaf35f01 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 21 Dec 2017 21:15:20 +0300 Subject: [PATCH] Tests: mariabackup.system_versioning [#387] --- .../mariabackup/system_versioning.result | 37 +++++++++++++++++-- .../suite/mariabackup/system_versioning.test | 31 +++++++++++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/mariabackup/system_versioning.result b/mysql-test/suite/mariabackup/system_versioning.result index 31928fd3bf1..22ccdb653f3 100644 --- a/mysql-test/suite/mariabackup/system_versioning.result +++ b/mysql-test/suite/mariabackup/system_versioning.result @@ -9,10 +9,7 @@ insert into t values (3); show create table t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) DEFAULT NULL, - `sys_trx_start` SYS_TRX_TYPE GENERATED ALWAYS AS ROW START, - `sys_trx_end` SYS_TRX_TYPE GENERATED ALWAYS AS ROW END, - PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`) + `a` int(11) DEFAULT NULL ) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING select * from t; a @@ -21,4 +18,36 @@ select a from t for system_time all; a 2 1 +set global system_versioning_transaction_registry=on; +Warnings: +Warning 4144 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future. +create or replace table t ( +a int, +s bigint unsigned as row start invisible, +e bigint unsigned as row end invisible, +period for system_time(s, e) +) with system versioning engine=innodb; +insert into t values (1); +update t set a=2; +insert into t values (3); +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `s` bigint(20) unsigned GENERATED ALWAYS AS ROW START INVISIBLE, + `e` bigint(20) unsigned GENERATED ALWAYS AS ROW END INVISIBLE, + PERIOD FOR SYSTEM_TIME (`s`, `e`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +select * from t; +a +2 +select a from t for system_time all; +a +2 +1 drop table t; +set global system_versioning_transaction_registry=off; diff --git a/mysql-test/suite/mariabackup/system_versioning.test b/mysql-test/suite/mariabackup/system_versioning.test index 7a51640892d..99392c3fc5b 100644 --- a/mysql-test/suite/mariabackup/system_versioning.test +++ b/mysql-test/suite/mariabackup/system_versioning.test @@ -15,11 +15,38 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir; -- source include/restart_and_restore.inc --enable_result_log ---replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE +--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM +show create table t; +select * from t; +select a from t for system_time all; + +rmdir $targetdir; + +set global system_versioning_transaction_registry=on; +create or replace table t ( + a int, + s bigint unsigned as row start invisible, + e bigint unsigned as row end invisible, + period for system_time(s, e) +) with system versioning engine=innodb; +insert into t values (1); +update t set a=2; + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log + +insert into t values (3); + +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + show create table t; select * from t; select a from t for system_time all; drop table t; +set global system_versioning_transaction_registry=off; rmdir $targetdir;