Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.6, 10.11, 11.4
Description
The function dict_stats_fetch_from_ps() first looks up the InnoDB persistent statistics tables in a suboptimal way, acquiring and releasing a shared dict_sys.latch multiple times, and then proceeds to acquire an exclusive dict_sys.latch for the duration of the call to que_eval_sql().
I think that this needs to be optimized as follows:
- Try to acquire a shared dict_sys.latch only once in the case that both statistics tables are cached in dict_sys and that a metadata lock (MDL) can be acquired without waiting.
- If one of the statistics tables is not cached or if we have to wait for a MDL, we may fall back to something like the existing logic.
- For the que_eval_sql() call, pass table handles with pars_info_bind_id(). In this way, there should be no need to hold any dict_sys.latch during the execution of the SQL.
Attachments
Issue Links
- relates to
-
MDEV-34988 InnoDB locks dict_sys.latch for a long time during ALTER TABLE
-
- Open
-
-
MDEV-34999 ha_innobase::open() should not acquire dict_sys.latch twice
-
- Open
-
It turns out that the InnoDB internal SQL parser pars_sql() must be covered by an exclusive dict_sys.latch, because that function is dealing with the global data structure pars_sym_tab_global. However, it is unnecessary to hold dict_sys.latch in any form during the execution of the parsed SQL graph.