Skip to content

Commit 9f92d64

Browse files
temeovuvova
authored andcommitted
MDEV-34493 memory leak when using galera node with only replication thread
Applying of write set containing many row events causes applier `thd->mem_root` to grow until applying is over. This may contribute to memory fragmentation problem, producing large chunks of memory which are not released back to operating system. In order to reduce memory fragmentation, free `thd->mem_root` in `Rows_log_event::do_apply_event()` after applying a row event with `F_STMT_END` set.
1 parent 340753e commit 9f92d64

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sql/log_event_server.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5969,7 +5969,11 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
59695969
slave_rows_error_report(ERROR_LEVEL, thd->is_error() ? 0 : error,
59705970
rgi, thd, table, get_type_str(),
59715971
RPL_LOG_NAME, log_pos);
5972-
if (thd->slave_thread)
5972+
if (thd->slave_thread
5973+
#ifdef WITH_WSREP
5974+
|| (WSREP(thd) && wsrep_thd_is_applying(thd))
5975+
#endif /* WITH_WSREP */
5976+
)
59735977
free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC));
59745978
}
59755979

0 commit comments

Comments
 (0)