diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-06-29 16:55:44 +0200 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-10-17 15:24:45 +0300 |
commit | 5d6971eacffbe1972f7878b36e089a357cb734f5 (patch) | |
tree | 4b42cd3b3607dac5a1317997ec6ae50f8d072fb4 | |
parent | 67fa0d4e7d649d50ae6f9e308a85911266fa1f70 (diff) | |
download | mariadb-git-5d6971eacffbe1972f7878b36e089a357cb734f5.tar.gz |
put binlog_cache_data on a memroot
-rw-r--r-- | sql/log.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/log.cc b/sql/log.cc index a1b66908ab2..bfce4000a51 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -275,7 +275,7 @@ void make_default_log_name(char **out, const char* log_ext, bool once) Helper classes to store non-transactional and transactional data before copying it to the binary log. */ -class binlog_cache_data: public ilist_node<> +class binlog_cache_data: public Sql_alloc, public ilist_node<> { public: binlog_cache_data(): share(0), sv_list(0), m_pending(0), status(0), @@ -6326,9 +6326,9 @@ write_err: #ifdef HAVE_REPLICATION -binlog_cache_data *binlog_setup_cache_data(TABLE_SHARE *share) +static binlog_cache_data *binlog_setup_cache_data(MEM_ROOT *root, TABLE_SHARE *share) { - auto cache= new binlog_cache_data(); + auto cache= new (root) binlog_cache_data(); if (!cache || open_cached_file(&cache->cache_log, mysql_tmpdir, LOG_PREFIX, (size_t)binlog_cache_size, MYF(MY_WME))) { @@ -6354,7 +6354,9 @@ binlog_cache_data *online_alter_binlog_get_cache_data(THD *thd, TABLE *table) return &cache; } - auto *new_cache_data= binlog_setup_cache_data(table->s); + MEM_ROOT *root= thd->in_multi_stmt_transaction_mode() + ? &thd->transaction->mem_root : thd->mem_root; + auto *new_cache_data= binlog_setup_cache_data(root, table->s); list.push_back(*new_cache_data); return new_cache_data; |