Hi, Michael! On Mar 27, Michael Widenius wrote:
revision-id: c157c285db9 (mariadb-10.5.2-514-gc157c285db9) parent(s): 16e38888c06 author: Michael Widenius <michael.widenius@gmail.com> committer: Michael Widenius <michael.widenius@gmail.com> timestamp: 2021-03-24 14:31:53 +0200 message:
Optimize Sql_alloc
- Remove 'dummy_for_valgrind' overrun marker as this doesn't help much. The element also distorts the sizes of objects a bit, which makes it harder to calculate gain in object sizes when doing size optimizations. - Avoid one extra call indirection when using thd_get_current_thd(), which is used by Sql_alloc.
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4f522d96a9f..1ab52401705 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -662,7 +662,15 @@ static std::atomic<char*> shutdown_user;
static thread_local THD *THR_THD;
+/** + Get current THD object from thread local data + + @retval The THD object for the thread, NULL if not connection thread +*/ + MYSQL_THD _current_thd() { return THR_THD; } +THD *thd_get_current_thd() { return THR_THD; }
I'd rather remove thd_get_current_thd() completely, why do we need two identical functions? Sql_alloc can use _current_thd() just fine, I've tried (also rocksdb uses thd_get_current_thd in one place, but it can use current_thd like the rest of the server code). Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org