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

Server crashes in Index_statistics::avg_frequency_is_inited on concurrent ALTER and SELECT from a normal table and I_S

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.1
    • 10.0.1
    • None
    • None

    Description

      #3  <signal handler called>
      #4  0x00000000006a3826 in Index_statistics::avg_frequency_is_inited (this=0x0) at /home10.0-base/sql/sql_statistics.h:234
      #5  0x00000000006a334e in set_statistics_for_table (thd=0x2d6abb0, table=0x7f84c0ef4440) at /home10.0-base/sql/sql_statistics.cc:3046
      #6  0x0000000000695197 in get_schema_stat_record (thd=0x2d6abb0, tables=0x7f84c0ef3e08, table=0x7f84c0df6ef8, res=false, db_name=0x7f84c0de3ca8, table_name=0x7f84c0eebcd8) at /home10.0-base/sql/sql_show.cc:5937
      #7  0x000000000068da7c in fill_schema_table_by_open (thd=0x2d6abb0, is_show_fields_or_keys=false, table=0x7f84c0df6ef8, schema_table=0x13ab1a0, orig_db_name=0x7f84c0de3ca8, orig_table_name=0x7f84c0eebcd8, open_tables_state_backup=0x7f84bb513210, can_deadlock=false) at /home10.0-base/sql/sql_show.cc:4078
      #8  0x000000000068f094 in get_all_tables (thd=0x2d6abb0, tables=0x7f84c0e83918, cond=0x7f84c0dd8e28) at /home10.0-base/sql/sql_show.cc:4731
      #9  0x000000000069d00e in do_fill_table (thd=0x2d6abb0, table_list=0x7f84c0e83918, join_table=0x7f84c0e9cc58) at /home10.0-base/sql/sql_show.cc:7887
      #10 0x000000000069d420 in get_schema_tables_result (join=0x7f84c0de2748, executed_place=PROCESSED_BY_JOIN_EXEC) at /home10.0-base/sql/sql_show.cc:7994
      #11 0x0000000000646bc8 in JOIN::exec_inner (this=0x7f84c0de2748) at /home10.0-base/sql/sql_select.cc:2414
      #12 0x0000000000646225 in JOIN::exec (this=0x7f84c0de2748) at /home10.0-base/sql/sql_select.cc:2258
      #13 0x000000000064984d in mysql_select (thd=0x2d6abb0, rref_pointer_array=0x2d6dad0, tables=0x7f84c0e83918, wild_num=1, fields=..., conds=0x7f84c0e2a428, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7f84c0e43c58, unit=0x2d6d128, select_lex=0x2d6d820) at /home10.0-base/sql/sql_select.cc:3194
      #14 0x00000000006400de in handle_select (thd=0x2d6abb0, lex=0x2d6d078, result=0x7f84c0e43c58, setup_tables_done_option=0) at /home10.0-base/sql/sql_select.cc:368
      #15 0x0000000000617963 in execute_sqlcom_select (thd=0x2d6abb0, all_tables=0x7f84c0e83918) at /home10.0-base/sql/sql_parse.cc:4766
      #16 0x000000000060fff3 in mysql_execute_command (thd=0x2d6abb0) at /home10.0-base/sql/sql_parse.cc:2246
      #17 0x000000000061a1cb in mysql_parse (thd=0x2d6abb0, rawbuf=0x7f84c0e0f448 "SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE `INDEX_TYPE` <> 'int' AND `TABLE_CATALOG` <= 'test'", length=101, parser_state=0x7f84bb5144f0) at /home10.0-base/sql/sql_parse.cc:5881
      #18 0x000000000060d339 in dispatch_command (command=COM_QUERY, thd=0x2d6abb0, packet=0x2d6e8d1 "SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE `INDEX_TYPE` <> 'int' AND `TABLE_CATALOG` <= 'test'", packet_length=101) at /home10.0-base/sql/sql_parse.cc:1072
      #19 0x000000000060c5f0 in do_command (thd=0x2d6abb0) at /home10.0-base/sql/sql_parse.cc:811
      #20 0x0000000000720ab5 in do_handle_one_connection (thd_arg=0x2d6abb0) at /home10.0-base/sql/sql_connect.cc:1253
      #21 0x00000000007204a0 in handle_one_connection (arg=0x2d6abb0) at /home10.0-base/sql/sql_connect.cc:1168
      #22 0x0000000000bc68c1 in pfs_spawn_thread (arg=0x2d577f0) at /home10.0-base/storage/perfschema/pfs.cc:1015
      #23 0x00007f84d19efefc in start_thread (arg=0x7f84bb515700) at pthread_create.c:304
      #24 0x00007f84d0d61f4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      revision-id: igor@askmonty.org-20130109033433-5awdv0w6vbpigltw
      revno: 3458
      branch-nick: 10.0-base

      Built with BUILD/compile-pentium-valgrind-max-no-ndb.
      Was also reproducible with BUILD/compile-pentium-debug-max-no-ndb.
      With more concurrency was also happening on non-debug builds.
      Reproducible on at least 2 different machines (Ubuntu 64-bit and Windows Server 2012 64-bit).

      There is an MTR concurrent test and an RQG grammar; the flow in them is exactly the same. RQG crashes on my machines within seconds after start, MTR takes longer, sometimes several minutes. Please choose whichever works better for you.

      MTR test case

      # Run as perl mysql-test-run.pl --mysqld=--disable-debug <test name>
      # (It happens without --disable-debug too, but with the option it seems to happen faster)
       
      --source include/have_xtradb.inc
       
      SET GLOBAL use_stat_tables = PREFERABLY;
      DROP TABLE IF EXISTS A;
      CREATE TABLE A ( `col_int_nokey` INT, `col_int_key` INT, KEY (`col_int_key`) ) ENGINE=InnoDB;
      INSERT INTO A VALUES (7, 1),(4, 2);
       
      --connect (con1,localhost,root,,)
      --connect (con2,localhost,root,,)
       
      --let $run = 1000
       
      --disable_query_log
      --disable_result_log
       
      while ($run)
      {
      --echo # $run rounds left
      --connection default
      --send
      ALTER TABLE A ADD COLUMN k INTEGER;
       
      --connection con1
      --send
      SELECT * FROM A;
       
      --connection con2
        SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE `INDEX_TYPE` <> 'int' AND `TABLE_CATALOG` <= 'test';
       
      --connection con1
      --reap
       
      --connection default
      --reap
        ALTER TABLE A DROP COLUMN k;
       
      --dec $run
      }
      --echo # All done
       
      --enable_query_log
      --enable_result_log
      DROP TABLE A;

      RQG test

      start MariaDB server with 
      --port=3306 --disable-debug 
      (no other options are required except for usual paths etc.);
      bzr branch lp:randgen (if not branched yet);
      cd randgen
      # create an empty test.yy file and copy the contents of the grammar below into it;
      run
      perl ./gentest.pl --threads=3 --queries=100M --duration=400 --dsn=dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test --grammar=test.yy

      Grammar:

       
      thread1_init:
        SET use_stat_tables = PREFERABLY 
        ; DROP TABLE IF EXISTS A 
        ; CREATE TABLE A ( `col_int_nokey` INT, `col_int_key` INT, KEY (`col_int_key`) ) ENGINE=InnoDB 
        ; INSERT INTO A VALUES (7, 1),(4, 2) ;
       
      thread1:
      	ALTER TABLE A ADD COLUMN _letter INTEGER |
      	ALTER TABLE A DROP COLUMN _letter ;
       
      thread2:
        SELECT * FROM A ;
       
      query:
        SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE `INDEX_TYPE` <> 'int' AND `TABLE_CATALOG` <= 'test' ;

      Attachments

        Activity

          People

            igor Igor Babaev
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.