Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
-
None
Description
Note: While it currently fails for me every time, the test case is still non-deterministic, try to run with --repeat=N if it doesn't fail for you right away.
--source include/have_innodb.inc
|
|
SET @stats.save= @@innodb_stats_persistent; |
SET GLOBAL innodb_stats_persistent= ON; |
|
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4); |
|
CREATE TABLE t2 (b INT, FOREIGN KEY (b) REFERENCES t1 (a) ON DELETE CASCADE) ENGINE=InnoDB; |
INSERT INTO t2 VALUES (1),(2),(3),(4); |
|
--connect (con1,localhost,root,,test)
|
--send
|
RENAME TABLE t2 TO tmp, tmp TO t2; |
|
--connection default
|
SELECT * INTO OUTFILE 'load_t1' FROM t1; |
LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1; |
|
# Cleanup
|
--connection con1
|
--reap
|
--disconnect con1
|
--connection default
|
--let $datadir= `SELECT @@datadir`
|
--remove_file $datadir/test/load_t1
|
DROP TABLE t2, t1; |
SET GLOBAL innodb_stats_persistent= @stats.save; |
10.2 d752a97e |
mysqld: /data/src/10.2/storage/innobase/dict/dict0stats_bg.cc:156: void dict_stats_update_if_needed(dict_table_t*, THD*): Assertion `table->stat_initialized' failed.
|
191029 23:41:29 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f9b71f36f12 in __GI___assert_fail (assertion=0x5617ea6adb45 "table->stat_initialized", file=0x5617ea6adcb0 "/data/src/10.2/storage/innobase/dict/dict0stats_bg.cc", line=156, function=0x5617ea6ae360 <dict_stats_update_if_needed(dict_table_t*, THD*)::__PRETTY_FUNCTION__> "void dict_stats_update_if_needed(dict_table_t*, THD*)") at assert.c:101
|
#8 0x00005617ea169a0d in dict_stats_update_if_needed (table=0x7f9b1800c108, thd=0x7f9b18000b00) at /data/src/10.2/storage/innobase/dict/dict0stats_bg.cc:156
|
#9 0x00005617e9fc596f in row_update_cascade_for_mysql (thr=0x7f9b18073f88, node=0x7f9b1808b1c8, table=0x7f9b1800c108) at /data/src/10.2/storage/innobase/row/row0mysql.cc:2155
|
#10 0x00005617e9fa1b20 in row_ins_foreign_check_on_constraint (thr=0x7f9b18073f88, foreign=0x7f9b18087f48, pcur=0x7f9b6c580540, entry=0x7f9b18084ac8, mtr=0x7f9b6c5809a0) at /data/src/10.2/storage/innobase/row/row0ins.cc:1430
|
#11 0x00005617e9fa290b in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7f9b18087f48, table=0x7f9b180311e8, entry=0x7f9b18084ac8, thr=0x7f9b18073f88) at /data/src/10.2/storage/innobase/row/row0ins.cc:1819
|
#12 0x00005617ea016029 in row_upd_check_references_constraints (node=0x7f9b18073c80, pcur=0x7f9b6c581050, table=0x7f9b180311e8, index=0x7f9b18070b88, offsets=0x7f9b18086070, thr=0x7f9b18073f88, mtr=0x7f9b6c5815d0) at /data/src/10.2/storage/innobase/row/row0upd.cc:326
|
#13 0x00005617ea01a8d0 in row_upd_sec_index_entry (node=0x7f9b18073c80, thr=0x7f9b18073f88) at /data/src/10.2/storage/innobase/row/row0upd.cc:2505
|
#14 0x00005617ea01ab63 in row_upd_sec_step (node=0x7f9b18073c80, thr=0x7f9b18073f88) at /data/src/10.2/storage/innobase/row/row0upd.cc:2554
|
#15 0x00005617ea01cdec in row_upd (node=0x7f9b18073c80, thr=0x7f9b18073f88) at /data/src/10.2/storage/innobase/row/row0upd.cc:3310
|
#16 0x00005617ea01d140 in row_upd_step (thr=0x7f9b18073f88) at /data/src/10.2/storage/innobase/row/row0upd.cc:3427
|
#17 0x00005617e9fc4e5a in row_update_for_mysql (prebuilt=0x7f9b18073168) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1828
|
#18 0x00005617e9e87633 in ha_innobase::delete_row (this=0x7f9b180729d8, record=0x7f9b18006650 "\245\001") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9136
|
#19 0x00005617e9c82bc8 in handler::ha_delete_row (this=0x7f9b180729d8, buf=0x7f9b18006650 "\245\001") at /data/src/10.2/sql/handler.cc:6149
|
#20 0x00005617e99d1a7c in write_record (thd=0x7f9b18000b00, table=0x7f9b18071dd0, info=0x7f9b6c582090) at /data/src/10.2/sql/sql_insert.cc:1905
|
#21 0x00005617e9e19d0d in read_sep_field (thd=0x7f9b18000b00, info=..., table_list=0x7f9b180125d0, fields_vars=..., set_fields=..., set_values=..., read_info=..., enclosed=..., skip_lines=0, ignore_check_option_errors=false) at /data/src/10.2/sql/sql_load.cc:1175
|
#22 0x00005617e9e18378 in mysql_load (thd=0x7f9b18000b00, ex=0x7f9b18012548, table_list=0x7f9b180125d0, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=false, read_file_from_client=false) at /data/src/10.2/sql/sql_load.cc:682
|
#23 0x00005617e99f7d3e in mysql_execute_command (thd=0x7f9b18000b00) at /data/src/10.2/sql/sql_parse.cc:4580
|
#24 0x00005617e9a01d20 in mysql_parse (thd=0x7f9b18000b00, rawbuf=0x7f9b18012468 "LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1", length=48, parser_state=0x7f9b6c583200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7759
|
#25 0x00005617e99f0029 in dispatch_command (command=COM_QUERY, thd=0x7f9b18000b00, packet=0x7f9b18095fc1 "LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1831
|
#26 0x00005617e99ee97d in do_command (thd=0x7f9b18000b00) at /data/src/10.2/sql/sql_parse.cc:1384
|
#27 0x00005617e9b43f57 in do_handle_one_connection (connect=0x5617ebf67170) at /data/src/10.2/sql/sql_connect.cc:1336
|
#28 0x00005617e9b43cc2 in handle_one_connection (arg=0x5617ebf67170) at /data/src/10.2/sql/sql_connect.cc:1241
|
#29 0x00005617ea37656e in pfs_spawn_thread (arg=0x5617ebf8a420) at /data/src/10.2/storage/perfschema/pfs.cc:1862
|
#30 0x00007f9b73aac4a4 in start_thread (arg=0x7f9b6c584700) at pthread_create.c:456
|
#31 0x00007f9b71ff3d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.2-10.5 debug builds. Couldn't reproduce on 10.1, MySQL 5.6, 5.7, 8.0. No obvious effect on a non-debug build.
Attachments
Issue Links
- is duplicated by
-
MDEV-24379 Assertion `table->stat_initialized' failed in dict0stats_bg.cc
-
- Closed
-
I can reproduce this with some iterations of
./mtr --parallel=auto --rr=-h MDEV-18802{,,,,,,,,,,,,,,,}; do :; done
The flag was cleared some time earlier:
10.2 75dd7a048315affc0c5986b6e955965d46621c6a
#0 0x0000562b60de9d0e in dict_stats_deinit (table=0x1cac7816bc00) at /mariadb/10.2o/storage/innobase/include/dict0stats.ic:185
#1 0x0000562b60dea647 in dict_table_close (table=0x1cac7816bc00, dict_locked=0, try_drop=0) at /mariadb/10.2o/storage/innobase/dict/dict0dict.cc:369
#2 0x0000562b60c8711a in row_prebuilt_free (prebuilt=0x1cac78081db0, dict_locked=0) at /mariadb/10.2o/storage/innobase/row/row0mysql.cc:1030
#3 0x0000562b60b51e04 in ha_innobase::close (this=0x1cac78081630) at /mariadb/10.2o/storage/innobase/handler/ha_innodb.cc:6669
#4 0x0000562b60977603 in handler::ha_close (this=0x1cac78081630) at /mariadb/10.2o/sql/handler.cc:2657
#5 0x0000562b6081a8ba in closefrm (table=0x1cac78080a98) at /mariadb/10.2o/sql/table.cc:3525
#6 0x0000562b608f1901 in intern_close_table (table=0x1cac78080a98) at /mariadb/10.2o/sql/table_cache.cc:222
#7 0x0000562b608f3de9 in tdc_remove_table (thd=0x7f15ec000d28, remove_type=TDC_RT_REMOVE_ALL, db=0x7f15ec010d70 "test", table_name=0x7f15ec0106f0 "t2", kill_delayed_threads=false)
at /mariadb/10.2o/sql/table_cache.cc:1132
#8 0x0000562b6074b7b0 in do_rename (thd=0x7f15ec000d28, ren_table=0x7f15ec010758, new_db=0x7f15ec011398 "test", new_table_name=0x7f15ec010720 "tmp", new_table_alias=0x7f15ec010d78 "tmp", skip_error=false)
at /mariadb/10.2o/sql/sql_rename.cc:286
#9 0x0000562b6074ba40 in rename_tables (thd=0x7f15ec000d28, table_list=0x7f15ec010758, skip_error=false) at /mariadb/10.2o/sql/sql_rename.cc:380
#10 0x0000562b6074b415 in mysql_rename_tables (thd=0x7f15ec000d28, table_list=0x7f15ec010758, silent=false) at /mariadb/10.2o/sql/sql_rename.cc:152
#11 0x0000562b60722f1d in mysql_execute_command (thd=0x7f15ec000d28) at /mariadb/10.2o/sql/sql_parse.cc:3977
#12 0x0000562b6072eb41 in mysql_parse (thd=0x7f15ec000d28, rawbuf=0x7f15ec010640 "RENAME TABLE t2 TO tmp, tmp TO t2", length=33, parser_state=0x6649380495f0, is_com_multi=false, is_next_command=false)
at /mariadb/10.2o/sql/sql_parse.cc:7794
#13 0x0000562b6071d590 in dispatch_command (command=COM_QUERY, thd=0x7f15ec000d28, packet=0x7f15ec008329 "RENAME TABLE t2 TO tmp, tmp TO t2", packet_length=33, is_com_multi=false, is_next_command=false)
at /mariadb/10.2o/sql/sql_parse.cc:1827
The assertion fails in:
#5 0x0000562b60c89974 in row_update_cascade_for_mysql (thr=0x1cac78169860, node=0x1cac78182d30, table=0x1cac7816bc00) at /mariadb/10.2o/storage/innobase/row/row0mysql.cc:2148
#6 0x0000562b60c664f2 in row_ins_foreign_check_on_constraint (thr=0x1cac78169860, foreign=0x1cac78161630, pcur=0x4417765f6030, entry=0x1cac7816b860, mtr=0x4417765f63d0)
at /mariadb/10.2o/storage/innobase/row/row0ins.cc:1360
#7 0x0000562b60c6728a in row_ins_check_foreign_constraint (check_ref=0, foreign=0x1cac78161630, table=0x1cac781714b0, entry=0x1cac7816b860, thr=0x1cac78169860)
at /mariadb/10.2o/storage/innobase/row/row0ins.cc:1749
#8 0x0000562b60cd5eb3 in row_upd_check_references_constraints (node=0x1cac78169558, pcur=0x4417765f6a00, table=0x1cac781714b0, index=0x1cac78172040, offsets=0x1cac78082bb8, thr=0x1cac78169860,
mtr=0x4417765f6c80) at /mariadb/10.2o/storage/innobase/row/row0upd.cc:323
#9 0x0000562b60cda8f2 in row_upd_sec_index_entry (node=0x1cac78169558, thr=0x1cac78169860) at /mariadb/10.2o/storage/innobase/row/row0upd.cc:2503
…
#20 0x0000562b6072eb41 in mysql_parse (thd=0x1cac78000d28, rawbuf=0x1cac78011710 "LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1", length=48, parser_state=0x4417765f85f0, is_com_multi=false,
is_next_command=false) at /mariadb/10.2o/sql/sql_parse.cc:7794
I think that the easiest fix is to replace the assertion with an if and early return.