[MDEV-31903] Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions Created: 2023-08-11  Updated: 2023-12-07

Status: Stalled
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.11, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: crash, pushing

Issue Links:
Relates
relates to MDEV-22829 SIGSEGV in _ma_reset_history on LOCK ... Closed

 Description   

--source include/have_partition.inc
 
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;

Version: '10.9.8-MariaDB-debug-log'  
230811 13:00:49 [ERROR] mysqld got signal 11 ;
 
Server version: 10.9.8-MariaDB-debug-log source revision: 27dc4cd1fc148960abfca9652b36c26b71ef49ea
 
sql/signal_handler.cc:241(handle_fatal_signal)[0x55d3689aef57]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f433f816730]
maria/ma_state.c:823(_ma_reset_history)[0x55d368f663c2]
maria/ma_state.c:484(_ma_trnman_end_trans_hook)[0x55d368f63c49]
maria/trnman.c:497(trnman_end_trn)[0x55d368fb3e74]
maria/ma_commit.c:73(ma_commit)[0x55d36903a22f]
maria/ha_maria.cc:2989(ha_maria::external_lock(THD*, int))[0x55d368fa68df]
sql/handler.cc:7145(handler::ha_external_lock(THD*, int))[0x55d3689eacef]
sql/ha_partition.cc:4285(ha_partition::external_lock(THD*, int))[0x55d3691e23ca]
sql/handler.cc:7145(handler::ha_external_lock(THD*, int))[0x55d3689eabed]
sql/handler.h:3509(handler::ha_external_unlock(THD*))[0x55d367ddaa88]
sql/lock.cc:744(unlock_external(THD*, TABLE**, unsigned int))[0x55d368d3d9b5]
sql/lock.cc:435(mysql_unlock_tables(THD*, st_mysql_lock*, bool))[0x55d368d3b06a]
sql/lock.cc:421(mysql_unlock_tables(THD*, st_mysql_lock*))[0x55d368d3aeb0]
sql/sql_base.cc:958(close_thread_tables(THD*))[0x55d367f334bd]
sql/sql_base.cc:2583(Locked_tables_list::unlock_locked_tables(THD*))[0x55d367f3ce2c]
sql/sql_parse.cc:5091(mysql_execute_command(THD*, bool))[0x55d3680f4c33]
sql/sql_parse.cc:8060(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55d368108b3d]
sql/sql_parse.cc:1896(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55d3680dedb0]
sql/sql_parse.cc:1407(do_command(THD*, bool))[0x55d3680dbab2]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55d368588314]
sql/sql_connect.cc:1320(handle_one_connection)[0x55d368587c6a]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55d36922dbdf]
nptl/pthread_create.c:487(start_thread)[0x7f433f80bfa3]
x86_64/clone.S:97(clone)[0x7f433f41506f]
 
Query (0x6290000e62a8): unlock tables



 Comments   
Comment by Aleksey Midenkov [ 2023-09-22 ]

Please review bb-10.9-midenok

Comment by Nikita Malyavin [ 2023-10-19 ]

Quite an elegant fix, great. Ok to push.

Generated at Thu Feb 08 10:27:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.