
Hi, ShawnYan, On Mar 30, ShawnYan via developers wrote:
hi, there, when I check release notes, https://mariadb.com/kb/en/mariadb-10419-changelog/ I notice this commit record, Revision #f24038b851 2021-03-07 14:06:01 +0100 mark Aria allocations for temp tables as MY_THREAD_SPECIFIC but, it can not find in the jira system, can't learn more detail/background about this commit, could anyone help with it, may we know which task refer to this commit? https://github.com/MariaDB/server/commit/f24038b851 Thank you.
MariaDB internally distinguishes "global" and "thread-local" memory allocations for the purpose of memory accounting. For "global" allocations the memory can be allocated in one thread and freed in another. A query cache, for example, is global. "local" allocations always owned by a specific thread. Temporary tables, for example, are always thread-local. That commit marks all allocations for Aria temporary tables to be thread-local. Why it was done at that point in time? The following commit is commit 01a0d739c8f Author: Sergei Golubchik <serg@mariadb.org> Date: Sun Mar 7 01:53:52 2021 +0100 MDEV-24975 Server consumes extra 4G memory upon querying INFORMATION_SCHEMA.OPTIIMIZER_TRACE and the test case in that commit does set max_session_mem_used=1024*1024*1024; select count(*) from information_schema.optimizer_trace; I suppose max_session_mem_used did not apply to temporary Aria tables, because they weren't marked MY_THREAD_SPECIFIC. So the first commit fixes temporary Aria tables to use MY_THREAD_SPECIFIC, and the second commit introduces a test case that relies on that. Regards, Sergei Chief Architect, MariaDB Server and security@mariadb.org