From 114476f2ec8244bd02b0f51fdaca05e055a2c1dc Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Mon, 7 Mar 2022 21:17:39 -0600 Subject: MDEV-27978 fix wrong name in error when max_session_mem_used exceeded Fixed typo in my_malloc_size_cb_func. There is no max-thread-mem-used sys variable in MariaDB, only max-session-mem-used. The relevant entry in sys_vars.cc is also fixed. Added a fallback case in case we could allocate the 256 bytes for the error message containing the exact setting. --- sql/mysqld.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sql/mysqld.cc') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6a7ea117c84..7f18f758d13 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4090,13 +4090,18 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) /* Ensure we don't get called here again */ char buf[50], *buf2; thd->set_killed(KILL_QUERY); - my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu", + my_snprintf(buf, sizeof(buf), "--max-session-mem-used=%llu", thd->variables.max_mem_used); if ((buf2= (char*) thd->alloc(256))) { my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf); thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, buf2); } + else + { + thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, + "--max-session-mem-used"); + } } DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 || !debug_assert_on_not_freed_memory); -- cgit v1.2.1