| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_partition.inc |
| 3 |
|
| 4 |
--let $datadir=`select @@datadir` |
| 5 |
|
| 6 |
create table t1 (a int); |
| 7 |
show create table t1; |
| 8 |
|
| 9 |
--error ER_VERS_NOT_SUPPORTED |
| 10 |
create temporary table tt1 (a int) with system versioning; |
| 11 |
|
| 12 |
set @old_dbug=@@global.debug_dbug; |
| 13 |
set global debug_dbug='+d,sysvers_force'; |
| 14 |
|
| 15 |
create table t2 (a int); |
| 16 |
show create table t2; |
| 17 |
|
| 18 |
create temporary table tt2 (a int) with system versioning; |
| 19 |
show create table tt2; |
| 20 |
|
| 21 |
--connect con1, localhost, root |
| 22 |
|
| 23 |
create table t3 (a int); |
| 24 |
show create table t3; |
| 25 |
|
| 26 |
create temporary table tt3 (a int) with system versioning; |
| 27 |
show create table tt3; |
| 28 |
--disconnect con1 |
| 29 |
--connection default |
| 30 |
|
| 31 |
set debug_dbug='+d,sysvers_show'; |
| 32 |
|
| 33 |
show create table t3; |
| 34 |
create table t4 (a int); |
| 35 |
show create table t4; |
| 36 |
drop table t1, t2, t3, t4; |
| 37 |
set debug_dbug= @old_dbug; |
| 38 |
set global debug_dbug= @old_dbug; |
| 39 |
|
| 40 |
--echo # |
| 41 |
--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() |
| 42 |
--echo # |
| 43 |
create table t1 (x int) with system versioning; |
| 44 |
set debug_dbug='+d,error_vers_wrong_type'; |
| 45 |
--replace_result $datadir ./ |
| 46 |
--error ER_NOT_FORM_FILE |
| 47 |
show create table t1; |
| 48 |
--replace_result $datadir ./ |
| 49 |
show warnings; |
| 50 |
drop table t1; |
| 51 |
set debug_dbug= @old_dbug; |
| 52 |
|
| 53 |
|
| 54 |
--echo # |
| 55 |
--echo # MDEV-17554 Auto-create new partition for system versioned tables |
| 56 |
--echo # with history partitioned by INTERVAL/LIMIT |
| 57 |
--echo # |
| 58 |
call mtr.add_suppression("need more HISTORY partitions"); |
| 59 |
create or replace table t1 (x int) with system versioning |
| 60 |
partition by system_time limit 1 auto partitions 2; |
| 61 |
insert into t1 values (1); |
| 62 |
update t1 set x= x + 1; |
| 63 |
|
| 64 |
--connect con2, localhost, root |
| 65 |
--connect con1, localhost, root |
| 66 |
|
| 67 |
--disable_warnings |
| 68 |
--echo # Both threads create partition simultaneously |
| 69 |
--connection con1 |
| 70 |
set debug_sync= 'add_history_partition signal s1 wait_for s2'; |
| 71 |
send update t1 set x= x + 10; |
| 72 |
--connection con2 |
| 73 |
set debug_sync= 'now wait_for s1'; |
| 74 |
flush tables t1; |
| 75 |
set debug_sync= 'add_history_partition signal s2'; |
| 76 |
update t1 set x= x + 20; |
| 77 |
--connection con1 |
| 78 |
reap; |
| 79 |
--connection default |
| 80 |
# 1 or 2 history rows may be created depending on which UPDATE finishes first (MDEV-28459) |
| 81 |
# select partition_name, table_rows from information_schema.partitions |
| 82 |
# where table_name = 't1'; |
| 83 |
|
| 84 |
# Fill empty partition for next UPDATE to trigger auto-create |
| 85 |
update t1 set x= x + 2; |
| 86 |
|
| 87 |
--echo # Second thread skips to reopen 3 times until first thread creates partition |
| 88 |
--connection con1 |
| 89 |
set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2'; |
| 90 |
send update t1 set x= x + 30; |
| 91 |
--connection con2 |
| 92 |
set debug_sync= 'now WAIT_FOR s1'; |
| 93 |
set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3'; |
| 94 |
update t1 set x= x + 40; |
| 95 |
--connection con1 |
| 96 |
reap; |
| 97 |
--connection default |
| 98 |
# Same here (MDEV-28459) |
| 99 |
# select partition_name, table_rows from information_schema.partitions |
| 100 |
# where table_name = 't1'; |
| 101 |
--enable_warnings |
| 102 |
|
| 103 |
--disconnect con1 |
| 104 |
--disconnect con2 |
| 105 |
set @@timestamp= default; |
| 106 |
|
| 107 |
drop tables t1; |
| 108 |
set debug_sync= 'reset'; |