MDEV-37619 The forced use of THD accessors hurts InnoDB performance

Let us access some data members of THD directly, instead of invoking
non-inline accessor functions. Note: my_thread_id will be used instead
of the potentially narrower ulong data type.

Also, let us remove some functions from sql_class.cc that were only
being used by InnoDB or RocksDB, for no reason. RocksDB always had
access to the internals of THD.

Reviewed by: Sergei Golubchik
Tested by: Saahil Alam
This commit is contained in:
Marko Mäkelä 2025-09-16 15:18:32 +03:00
commit 9aca89fa9f
19 changed files with 125 additions and 232 deletions

View file

@ -90,15 +90,18 @@
#include "./rdb_threads.h"
#include "./rdb_mariadb_server_port.h"
// Internal MySQL APIs not exposed in any header.
extern "C" {
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
@param thd Thread handle
@param all TRUE <=> rollback main transaction.
*/
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
static inline void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)
{
return thd->mark_transaction_to_rollback(all);
}
// Internal MariaDB APIs not exposed in any header.
extern "C" {
/**
* Get the user thread's binary logging format
* @param thd user thread