Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.6, 10.11, 11.4
Description
In MDEV-31558 we wrongly thought that there would be minimal overhead for accessing a thread-local variable:
extern thread_local ha_handler_stats *mariadb_stats; |
It turns out that in C++11, each access to an extern thread_local variable requires conditionally invoking an initialization function. In fact, we do have a custom initializer of this very variable, so that call is actually unavoidable:
thread_local ha_handler_stats mariadb_dummy_stats;
|
thread_local ha_handler_stats *mariadb_stats= &mariadb_dummy_stats;
|
It turns out that already had a better declared thread local variable that the mariadb_stats would point to when it is not pointing to the dummy object:
static thread_local THD *THR_THD; |
|
MYSQL_THD _current_thd() { return THR_THD; } |
We can access THD::handler_stats directly (well, via an accessor function, because the definition of THD is hidden from the InnoDB storage engine).
Attachments
Issue Links
- is caused by
-
MDEV-31558 Add InnoDB engine information to the slow query log
- Closed
- relates to
-
MDEV-34297 get_rnd_value() of ib_counter_t is unnecessarily complex
- Closed