| 1 |
create table t1 (a int); |
| 2 |
show create table t1; |
| 3 |
Table Create Table |
| 4 |
t1 CREATE TABLE `t1` ( |
| 5 |
`a` int(11) DEFAULT NULL |
| 6 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 7 |
create temporary table tt1 (a int) with system versioning; |
| 8 |
ERROR HY000: System-versioned tables do not support CREATE TEMPORARY TABLE |
| 9 |
set @old_dbug=@@global.debug_dbug; |
| 10 |
set global debug_dbug='+d,sysvers_force'; |
| 11 |
create table t2 (a int); |
| 12 |
show create table t2; |
| 13 |
Table Create Table |
| 14 |
t2 CREATE TABLE `t2` ( |
| 15 |
`a` int(11) DEFAULT NULL |
| 16 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 17 |
create temporary table tt2 (a int) with system versioning; |
| 18 |
show create table tt2; |
| 19 |
Table Create Table |
| 20 |
tt2 CREATE TEMPORARY TABLE `tt2` ( |
| 21 |
`a` int(11) DEFAULT NULL |
| 22 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 23 |
connect con1, localhost, root; |
| 24 |
create table t3 (a int); |
| 25 |
show create table t3; |
| 26 |
Table Create Table |
| 27 |
t3 CREATE TABLE `t3` ( |
| 28 |
`a` int(11) DEFAULT NULL |
| 29 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 30 |
create temporary table tt3 (a int) with system versioning; |
| 31 |
show create table tt3; |
| 32 |
Table Create Table |
| 33 |
tt3 CREATE TEMPORARY TABLE `tt3` ( |
| 34 |
`a` int(11) DEFAULT NULL |
| 35 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 36 |
disconnect con1; |
| 37 |
connection default; |
| 38 |
set debug_dbug='+d,sysvers_show'; |
| 39 |
show create table t3; |
| 40 |
Table Create Table |
| 41 |
t3 CREATE TABLE `t3` ( |
| 42 |
`a` int(11) DEFAULT NULL |
| 43 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 44 |
create table t4 (a int); |
| 45 |
show create table t4; |
| 46 |
Table Create Table |
| 47 |
t4 CREATE TABLE `t4` ( |
| 48 |
`a` int(11) DEFAULT NULL, |
| 49 |
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START, |
| 50 |
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END, |
| 51 |
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) |
| 52 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING |
| 53 |
drop table t1, t2, t3, t4; |
| 54 |
set debug_dbug= @old_dbug; |
| 55 |
set global debug_dbug= @old_dbug; |
| 56 |
# |
| 57 |
# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() |
| 58 |
# |
| 59 |
create table t1 (x int) with system versioning; |
| 60 |
set debug_dbug='+d,error_vers_wrong_type'; |
| 61 |
show create table t1; |
| 62 |
ERROR HY000: Incorrect information in file: './test/t1.frm' |
| 63 |
show warnings; |
| 64 |
Level Code Message |
| 65 |
Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` |
| 66 |
Error 1033 Incorrect information in file: './test/t1.frm' |
| 67 |
drop table t1; |
| 68 |
set debug_dbug= @old_dbug; |
| 69 |
# |
| 70 |
# MDEV-17554 Auto-create new partition for system versioned tables |
| 71 |
# with history partitioned by INTERVAL/LIMIT |
| 72 |
# |
| 73 |
call mtr.add_suppression("need more HISTORY partitions"); |
| 74 |
create or replace table t1 (x int) with system versioning |
| 75 |
partition by system_time limit 1 auto partitions 2; |
| 76 |
insert into t1 values (1); |
| 77 |
update t1 set x= x + 1; |
| 78 |
connect con2, localhost, root; |
| 79 |
connect con1, localhost, root; |
| 80 |
# Both threads create partition simultaneously |
| 81 |
connection con1; |
| 82 |
set debug_sync= 'add_history_partition signal s1 wait_for s2'; |
| 83 |
update t1 set x= x + 10; |
| 84 |
connection con2; |
| 85 |
set debug_sync= 'now wait_for s1'; |
| 86 |
flush tables t1; |
| 87 |
set debug_sync= 'add_history_partition signal s2'; |
| 88 |
update t1 set x= x + 20; |
| 89 |
connection con1; |
| 90 |
connection default; |
| 91 |
update t1 set x= x + 2; |
| 92 |
# Second thread skips to reopen 3 times until first thread creates partition |
| 93 |
connection con1; |
| 94 |
set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2'; |
| 95 |
update t1 set x= x + 30; |
| 96 |
connection con2; |
| 97 |
set debug_sync= 'now WAIT_FOR s1'; |
| 98 |
set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3'; |
| 99 |
update t1 set x= x + 40; |
| 100 |
connection con1; |
| 101 |
connection default; |
| 102 |
disconnect con1; |
| 103 |
disconnect con2; |
| 104 |
set @@timestamp= default; |
| 105 |
drop tables t1; |
| 106 |
set debug_sync= 'reset'; |