summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2021-09-29 19:19:38 +0300
committerAndrei Elkin <andrei.elkin@mariadb.com>2021-10-13 19:02:15 +0300
commitbbae2d398f866b00f7e8ad71984884ff3375df52 (patch)
tree4401587f775f118e125415c3489626b12b59c91c
parentef0dc50c05594e4287a2a3e06aef8e2ab576b8cf (diff)
downloadmariadb-git-bbae2d398f866b00f7e8ad71984884ff3375df52.tar.gz
MDEV-26712 row events never reset thd->mem_root
but must do that at the end of the statement. A provide template patch is elaborated also to match to the upstream fixes of the very same bug.
-rw-r--r--sql/log_event.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 04577be4f6f..9108b57fec1 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -11208,12 +11208,17 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
}
#endif /* WITH_WSREP && HAVE_QUERY_CACHE */
- if (get_flags(STMT_END_F) && (error= rows_event_stmt_cleanup(rgi, thd)))
- slave_rows_error_report(ERROR_LEVEL,
- thd->is_error() ? 0 : error,
- rgi, thd, table,
- get_type_str(),
- RPL_LOG_NAME, (ulong) log_pos);
+ if (get_flags(STMT_END_F))
+ {
+ if ((error= rows_event_stmt_cleanup(rgi, thd)))
+ slave_rows_error_report(ERROR_LEVEL,
+ thd->is_error() ? 0 : error,
+ rgi, thd, table,
+ get_type_str(),
+ RPL_LOG_NAME, (ulong) log_pos);
+ if (thd->slave_thread)
+ free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC));
+ }
DBUG_RETURN(error);
err: