@@ -275,7 +275,7 @@ void make_default_log_name(char **out, const char* log_ext, bool once)
275
275
Helper classes to store non-transactional and transactional data
276
276
before copying it to the binary log.
277
277
*/
278
- class binlog_cache_data : public ilist_node <>
278
+ class binlog_cache_data : public Sql_alloc , public ilist_node <>
279
279
{
280
280
public:
281
281
binlog_cache_data (): share(0 ), sv_list(0 ), m_pending(0 ), status(0 ),
@@ -6382,9 +6382,9 @@ bool MYSQL_BIN_LOG::write_table_map(THD *thd, TABLE *table, bool with_annotate)
6382
6382
6383
6383
6384
6384
#ifdef HAVE_REPLICATION
6385
- binlog_cache_data *binlog_setup_cache_data (TABLE_SHARE *share)
6385
+ static binlog_cache_data *binlog_setup_cache_data (MEM_ROOT *root, TABLE_SHARE *share)
6386
6386
{
6387
- auto cache= new binlog_cache_data ();
6387
+ auto cache= new (root) binlog_cache_data ();
6388
6388
if (!cache || open_cached_file (&cache->cache_log , mysql_tmpdir,
6389
6389
LOG_PREFIX, (size_t )binlog_cache_size, MYF (MY_WME)))
6390
6390
{
@@ -6410,7 +6410,9 @@ binlog_cache_data *online_alter_binlog_get_cache_data(THD *thd, TABLE *table)
6410
6410
return &cache;
6411
6411
}
6412
6412
6413
- auto *new_cache_data= binlog_setup_cache_data (table->s );
6413
+ MEM_ROOT *root= thd->in_multi_stmt_transaction_mode ()
6414
+ ? &thd->transaction ->mem_root : thd->mem_root ;
6415
+ auto *new_cache_data= binlog_setup_cache_data (root, table->s );
6414
6416
list.push_back (*new_cache_data);
6415
6417
6416
6418
return new_cache_data;
0 commit comments