Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18802

Assertion `table->stat_initialized' failed in dict_stats_update_if_needed

    XMLWordPrintable

    Details

      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

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: