-- source include/have_innodb.inc -- source include/not_embedded.inc create or replace table t1 ( x int, sys_trx_start bigint(20) unsigned as row start invisible, sys_trx_end bigint(20) unsigned as row end invisible, period for system_time (sys_trx_start, sys_trx_end) ) with system versioning engine innodb; insert into t1 (x) values (1); --echo # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry create function check_result (cond boolean) returns char(50) deterministic return if(cond = 1, '[CORRECT]', '[INCORRECT]'); set @@system_versioning_alter_history=keep; create or replace table t1 (x int) engine innodb; insert into t1 values (1); alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, add period for system_time(s, e), add system versioning, algorithm=inplace; select s from t1 into @trx_start; select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int) engine innodb; select count(*) from mysql.transaction_registry into @tmp; alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, add period for system_time(s, e), add system versioning, algorithm=inplace; select check_result(count(*) = @tmp) from mysql.transaction_registry; create or replace table t1 (x int) engine innodb; insert into t1 values (1); alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, add period for system_time(s, e), add system versioning, algorithm=copy; select s from t1 into @trx_start; select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int) engine innodb; select count(*) from mysql.transaction_registry into @tmp; alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, add period for system_time(s, e), add system versioning, algorithm=copy; # With MDEV-14511 the transaction will be registered even for empty tables. select check_result(count(*) = @tmp + 1) from mysql.transaction_registry; --echo # TRX_ID to TIMESTAMP versioning switch create or replace table t1 ( x int, sys_start bigint unsigned as row start invisible, sys_end bigint unsigned as row end invisible, period for system_time (sys_start, sys_end) ) engine innodb with system versioning; insert into t1 values (1); alter table t1 drop column sys_start, drop column sys_end; select row_end = 18446744073709551615 as transaction_based from t1 for system_time all; drop table t1; drop function check_result;