Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Incomplete
-
10.2.22, 10.2.23
-
Happened on Windows, but it should happen both on Windows and Linux
Description
Recently we got a crash on our MariaDB server, the call stack is
alloc_histograms_for_table_share
|
read_histograms_for_table
|
read_statistics_for_tables_if_needed
|
open_and_lock_tables
|
The main problem is that the it try to read histogram of a performance schema table. In my understand, only TABLE_CATEGORY_USER should be read statistics because on open_and_process_table it only init stats when table is TABLE_CATEGORY_USER.
But when try to read histogram, when call statistics_for_tables_is_needed, the statistics_for_tables_is_needed return true instead of false.
I found in this commit https://github.com/MariaDB/server/commit/10f6b7001bd7b683c013ae407c2c48793caa3633 ,
the code changed from
if (table_share && |
(table_share->table_category != TABLE_CATEGORY_USER ||
|
table_share->tmp_table != NO_TMP_TABLE))
|
return FALSE; |
to
if (table_share && |
table_share->table_category != TABLE_CATEGORY_USER
|
&& is_stat_table(tl->db, tl->alias))
|
return FALSE; |
which means only mysql stats table will be ignored. This code change may be not correct.
Attachments
Issue Links
- relates to
-
MDEV-16507 SIGSEGV when use_stat_tables = preferably and optimizer_use_condition_selectivity = 4
-
- Closed
-
11 00000005`6096a800 00000005`01596baf mysqld!alloc_histograms_for_table_share+0x9c [d:\src\sql\sql_statistics.cc @ 2410]
12 00000005`6096a880 00000005`01597ac6 mysqld!read_histograms_for_table+0x6f [d:\src\sql\sql_statistics.cc @ 3210]
13 00000005`6096b8d0 00000005`01548ace mysqld!read_statistics_for_tables_if_needed+0x196 [d:\src\sql\sql_statistics.cc @ 3294]
14 00000005`6096cb90 00000005`01308b02 mysqld!open_and_lock_tables+0x7e [d:\src\sql\sql_base.cc @ 4732]
15 00000005`6096cbf0 00000005`01531f32 mysqld!open_and_lock_tables+0x42 [d:\src\sql\sql_base.h @ 500]
16 00000005`6096cc40 00000005`014bd8e8 mysqld!mysql_execute_command+0x2362 [d:\src\sql\sql_parse.cc @ 4529]
17 00000005`6096d900 00000005`014c1751 mysqld!sp_instr_stmt::exec_core+0x18 [d:\src\sql\sp_head.cc @ 3248]
18 00000005`6096d930 00000005`014be583 mysqld!sp_lex_keeper::reset_lex_and_exec_core+0xf1 [d:\src\sql\sp_head.cc @ 3009]
19 00000005`6096d980 00000005`014bdd87 mysqld!sp_instr_stmt::execute+0xd3 [d:\src\sql\sp_head.cc @ 3162]
1a 00000005`6096d9e0 00000005`014bf1e7 mysqld!sp_head::execute+0x3c7 [d:\src\sql\sp_head.cc @ 1327]
1b 00000005`6096dd20 00000005`0152cc68 mysqld!sp_head::execute_procedure+0x407 [d:\src\sql\sp_head.cc @ 2116]
1c 00000005`6096ddf0 00000005`0153403d mysqld!do_execute_sp+0xa8 [d:\src\sql\sql_parse.cc @ 2930]
1d (Inline Function) -------
`------- mysqld!THD::enter_stage+0x35db [d:\src\sql\sql_class.h @ 2321]1e 00000005`6096de20 00000005`01535020 mysqld!mysql_execute_command+0x446d [d:\src\sql\sql_parse.cc @ 6340]
1f 00000005`6096eae0 00000005`0152b816 mysqld!mysql_parse+0x190 [d:\src\sql\sql_parse.cc @ 8169]
20 00000005`6096eb40 00000005`0152cb40 mysqld!dispatch_command+0xb06 [d:\src\sql\sql_parse.cc @ 1841]
21 00000005`6096fb30 00000005`016329f3 mysqld!do_command+0x1b0 [d:\src\sql\sql_parse.cc @ 1386]
22 00000005`6096fba0 00000005`01632b60 mysqld!threadpool_process_request+0x53 [d:\src\sql\threadpool_common.cc @ 366]