Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5, 10.6, 10.11, 11.1(EOL), 11.2(EOL), 11.4, 11.5(EOL), 11.6(EOL)
-
None
Description
--source include/have_innodb.inc
|
|
CREATE TABLE t (c1 INT,c2 INT) ENGINE=INNODB; |
UPDATE mysql.innodb_index_stats SET stat_value=0; |
SELECT * FROM t; |
FLUSH TABLES;
|
UPDATE t SET c1=+1 ORDER BY c2; |
Leads to:
11.6.0 42294b8cd2cbb72c1d5da6058dd6f0c55669def7 (Optimized) |
InnoDB: Failing assertion: stat_n_leaf_pages > 0
|
11.6.0 42294b8cd2cbb72c1d5da6058dd6f0c55669def7 (Optimized) |
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
#1 0x000014ac7fa3a859 in __GI_abort () at abort.c:79
|
#2 0x000055fa1643c518 in ut_dbg_assertion_failed (expr=expr@entry=0x55fa171f486e "stat_n_leaf_pages > 0", file=file@entry=0x55fa171ee4c0 "/test/11.6_opt/storage/innobase/handler/ha_innodb.cc", line=line@entry=14341) at /test/11.6_opt/storage/innobase/ut/ut0dbg.cc:60
|
#3 0x000055fa164159d0 in ha_innobase::estimate_rows_upper_bound (this=0x14ac4c153440) at /test/11.6_opt/storage/innobase/handler/ha_innodb.cc:14341
|
#4 0x000055fa1684fc09 in filesort (thd=thd@entry=0x14ac4c000c58, table=table@entry=0x14ac4c107b68, filesort=filesort@entry=0x14ac780c18d0, tracker=0x14ac4c015018, join=join@entry=0x0, first_table_bit=first_table_bit@entry=0) at /test/11.6_opt/sql/filesort.cc:1490
|
#5 0x000055fa166b1546 in Sql_cmd_update::update_single_table (this=0x14ac4c0137c8, thd=0x14ac4c000c58) at /test/11.6_opt/sql/sql_update.cc:712
|
#6 0x000055fa166b31fd in Sql_cmd_update::execute_inner (this=0x14ac4c0137c8, thd=0x14ac4c000c58) at /test/11.6_opt/sql/sql_update.cc:3079
|
#7 0x000055fa165ff5db in Sql_cmd_dml::execute (this=0x14ac4c0137c8, thd=0x14ac4c000c58) at /test/11.6_opt/sql/sql_select.cc:33717
|
#8 0x000055fa165ca28d in mysql_execute_command (thd=0x14ac4c000c58, is_called_from_prepared_stmt=<optimized out>) at /test/11.6_opt/sql/sql_parse.cc:4402
|
#9 0x000055fa165b9846 in mysql_parse (thd=0x14ac4c000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/11.6_opt/sql/sql_parse.cc:7868
|
#10 0x000055fa165c602d in dispatch_command (command=COM_QUERY, thd=0x14ac4c000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.6_opt/sql/sql_class.h:1638
|
#11 0x000055fa165c849e in do_command (thd=0x14ac4c000c58, blocking=blocking@entry=true) at /test/11.6_opt/sql/sql_parse.cc:1405
|
#12 0x000055fa166fc8f7 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/11.6_opt/sql/sql_connect.cc:1448
|
#13 0x000055fa166fcc4d in handle_one_connection (arg=arg@entry=0x55fa1aa118c8) at /test/11.6_opt/sql/sql_connect.cc:1350
|
#14 0x000055fa16ab3e8c in pfs_spawn_thread (arg=0x55fa1a9b6458) at /test/11.6_opt/storage/perfschema/pfs.cc:2201
|
#15 0x000014ac7ff4b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#16 0x000014ac7fb37133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.5.26 (dbg), 10.5.26 (opt), 10.6.18 (dbg), 10.6.18 (opt), 10.11.8 (dbg), 10.11.8 (opt), 11.1.5 (dbg), 11.1.5 (opt), 11.2.4 (dbg), 11.2.4 (opt), 11.4.2 (dbg), 11.4.2 (opt), 11.5.1 (dbg), 11.5.1 (opt), 11.6.0 (dbg), 11.6.0 (opt)
The column mysql.innodb_index_stats.stat_value is declared as BIGINT UNSIGNED without any CHECK constraint. Therefore, we must tolerate any values that we can read from there, but maybe interpret them differently (such as interpreting the value 0 as 1). I see that there is also the column sample_size, which could suffer from a similar problem.
In mysql.innodb_table_stats the columns n_rows, clustered_index_size, sum_of_other_index_sizes had better be checked in a similar way.