diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index ebd48fa508c..69dd07e9525 100644 --- a/mysql-test/main/alter_table_online_debug.result +++ b/mysql-test/main/alter_table_online_debug.result @@ -1296,6 +1296,22 @@ connection default; select * from t; a b c drop table t; +# +# MDEV-30949 Direct leak in binlog_online_alter_end_trans +# +create table t (f longblob default null) engine=myisam; +insert into t values (null); +set debug_sync= "alter_table_copy_end signal copy wait_for goon"; +set debug_sync= "alter_table_online_before_lock signal lock wait_for end"; +alter table t force, algorithm=copy; +connection con1; +set debug_sync= "now wait_for copy"; +insert into t select repeat('a',130000); +set debug_sync= "now signal goon wait_for lock"; +insert into t select repeat('a',130000); +set debug_sync= "now signal end"; +connection default; +drop table t; set debug_sync= reset; disconnect con1; disconnect con2; diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test index 598153ccb68..43e69155407 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -1475,6 +1475,30 @@ dec $i; let local_engine=aria; } +--echo # +--echo # MDEV-30949 Direct leak in binlog_online_alter_end_trans +--echo # +create table t (f longblob default null) engine=myisam; +insert into t values (null); + +set debug_sync= "alter_table_copy_end signal copy wait_for goon"; +set debug_sync= "alter_table_online_before_lock signal lock wait_for end"; + +send alter table t force, algorithm=copy; + +--connection con1 +set debug_sync= "now wait_for copy"; +insert into t select repeat('a',130000); +set debug_sync= "now signal goon wait_for lock"; +insert into t select repeat('a',130000); +set debug_sync= "now signal end"; + + +--connection default +--reap +drop table t; + + set debug_sync= reset; --disconnect con1 --disconnect con2 diff --git a/sql/log.h b/sql/log.h index 3d5ffe68876..83e323cb6fb 100644 --- a/sql/log.h +++ b/sql/log.h @@ -512,7 +512,8 @@ public: private: void cleanup() { - end_io_cache(&alt_buf); + close_cached_file(&log_file); + close_cached_file(&alt_buf); Event_log::cleanup(); } };