[MDEV-31207] Memory leak when START ALTER fails on slave Created: 2023-05-06  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.8.1, 10.9.1, 10.10.1, 10.11.1, 11.0.1
Fix Version/s: 10.11, 11.0

Type: Bug Priority: Major
Reporter: Kristian Nielsen Assignee: Kristian Nielsen
Resolution: Unresolved Votes: 0
Labels: replication


 Description   

If the (parallel) slave fails while applying START ALTER, a memory leak of
the start_alter_info results. This is because the start_alter_info object is
added into the mi->start_alter_list in write_bin_log_start_alter(), however
if the START ALTER fails, this is not called.

I will push a fix for this on my branch knielsen_start_alter on github.

Test case:

--source include/have_innodb.inc
--source include/master-slave.inc
 
--connection master
CREATE TABLE t1 (a INT PRIMARY KEY);
 
--sync_slave_with_master
--source include/stop_slave.inc
DROP TABLE t1;
SET GLOBAL slave_parallel_threads = 5;
--source include/start_slave.inc
 
--connection master
SET binlog_alter_two_phase = ON;
ALTER TABLE t1 ADD COLUMN b INT DEFAULT NULL;
 
--connection slave
# 1146 = ER_NO_SUCH_TABLE
--let $slave_sql_errno= 1146
--source include/wait_for_slave_sql_error.inc
CREATE TABLE t1 (a INT PRIMARY KEY);
--source include/start_slave.inc
 
--connection master
DROP TABLE t1;
--source include/rpl_end.inc


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