MDEV-31903 Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions
When INSERT does auto-create for t1 all its handler instances are closed by alter_close_table(). At this time down the stack maria_close() clears share->state_history. Later when we unlock the tables Aria transaction manager accesses old share instance (the one before t1 was closed) and tries to reset its state_history. The problem is maria_close() didn't remove table from transaction's list (used_tables). The fix does _ma_remove_table_from_trnman() which is triggered by HA_EXTRA_PREPARE_FOR_RENAME.
This commit is contained in:
parent
a79fb66a98
commit
d966e55c0a
@ -3447,4 +3447,22 @@ ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTOR
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-31903 Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions
|
||||
#
|
||||
set timestamp= unix_timestamp('2000-01-01 00:00:00');
|
||||
create table t1 (x int) engine=aria with system versioning partition by system_time interval 1 hour auto partitions 3;
|
||||
insert into t1 values (1);
|
||||
create table t2 (x int) engine=aria;
|
||||
create trigger tr after insert on t2 for each row update t1 set x= x + 11;
|
||||
lock tables t1 write, t2 write;
|
||||
update t1 set x= x + 1;
|
||||
set timestamp= unix_timestamp('2000-01-01 13:00:00');
|
||||
insert into t2 values (5);
|
||||
unlock tables;
|
||||
drop table t1, t2;
|
||||
set timestamp= default;
|
||||
#
|
||||
# End of 10.9 tests
|
||||
#
|
||||
set global innodb_stats_persistent= @save_persistent;
|
||||
|
@ -2673,5 +2673,26 @@ create table t (a int) with system versioning partition by system_time partition
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31903 Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions
|
||||
--echo #
|
||||
set timestamp= unix_timestamp('2000-01-01 00:00:00');
|
||||
create table t1 (x int) engine=aria with system versioning partition by system_time interval 1 hour auto partitions 3;
|
||||
insert into t1 values (1);
|
||||
|
||||
create table t2 (x int) engine=aria;
|
||||
create trigger tr after insert on t2 for each row update t1 set x= x + 11;
|
||||
lock tables t1 write, t2 write;
|
||||
update t1 set x= x + 1;
|
||||
set timestamp= unix_timestamp('2000-01-01 13:00:00');
|
||||
insert into t2 values (5);
|
||||
unlock tables;
|
||||
drop table t1, t2;
|
||||
set timestamp= default;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.9 tests
|
||||
--echo #
|
||||
|
||||
set global innodb_stats_persistent= @save_persistent;
|
||||
--source suite/versioning/common_finish.inc
|
||||
|
@ -7753,7 +7753,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
|
||||
ERROR_INJECT("add_partition_1") ||
|
||||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
|
||||
ERROR_INJECT("add_partition_2") ||
|
||||
wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
|
||||
wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME) ||
|
||||
ERROR_INJECT("add_partition_3") ||
|
||||
write_log_add_change_partition(lpt) ||
|
||||
ERROR_INJECT("add_partition_4") ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user