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

Assertion `file->trn == trn' failed in ha_maria::start_stmt

Details

    Description

      CREATE TABLE t1 (i INT) ENGINE=Aria;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (c CHAR(1)) ENGINE=Aria;
      INSERT INTO t2 VALUES ('a'),('b');
       
      --connect (con1,localhost,root,,test)
      LOCK TABLE t1 WRITE;
      OPTIMIZE TABLE t1;
       
      --connection default
      DELETE FROM t2 WHERE c < 1;
       
      --connection con1
      OPTIMIZE TABLE t1;
       
      # Cleanup
      --disconnect con1
      --connection default
      DROP TABLE t1, t2;
      

      5.5 20089f5a39fa8f6f08113f12ed87c34e844c4fc6

      mysqld: /data/src/5.5/storage/maria/ha_maria.cc:2771: virtual int ha_maria::start_stmt(THD*, thr_lock_type): Assertion `file->trn == trn' failed.
      171216  0:44:06 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc0ece7eee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000000000094d51d in ha_maria::start_stmt (this=0x7fc0e7878078, thd=0x7fc0e8a69060, lock_type=TL_WRITE) at /data/src/5.5/storage/maria/ha_maria.cc:2771
      #9  0x00000000005a70ba in check_lock_and_start_stmt (thd=0x7fc0e8a69060, prelocking_ctx=0x7fc0e8a6c2e0, table_list=0x7fc0e7424148) at /data/src/5.5/sql/sql_base.cc:5522
      #10 0x00000000005a7fc0 in lock_tables (thd=0x7fc0e8a69060, tables=0x7fc0e7424148, count=1, flags=0) at /data/src/5.5/sql/sql_base.cc:5993
      #11 0x00000000005a7751 in open_and_lock_tables (thd=0x7fc0e8a69060, tables=0x7fc0e7424148, derived=true, flags=0, prelocking_strategy=0x7fc0ee8a8610) at /data/src/5.5/sql/sql_base.cc:5741
      #12 0x000000000059abff in open_and_lock_tables (thd=0x7fc0e8a69060, tables=0x7fc0e7424148, derived=true, flags=0) at /data/src/5.5/sql/sql_base.h:525
      #13 0x000000000070cddb in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *)) (thd=0x7fc0e8a69060, tables=0x7fc0e7424148, check_opt=0x7fc0e8a6d190, operator_name=0xd3ebe2 "optimize", lock_type=TL_WRITE, open_for_modify=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x7b577c <handler::ha_optimize(THD*, st_ha_check_opt*)>, view_operator_func=0x0) at /data/src/5.5/sql/sql_admin.cc:439
      #14 0x000000000070f166 in Optimize_table_statement::execute (this=0x7fc0e7424720, thd=0x7fc0e8a69060) at /data/src/5.5/sql/sql_admin.cc:1138
      #15 0x000000000060658a in mysql_execute_command (thd=0x7fc0e8a69060) at /data/src/5.5/sql/sql_parse.cc:4503
      #16 0x00000000006098ce in mysql_parse (thd=0x7fc0e8a69060, rawbuf=0x7fc0e7424078 "OPTIMIZE TABLE t1", length=17, parser_state=0x7fc0ee8a9640) at /data/src/5.5/sql/sql_parse.cc:5923
      #17 0x00000000005fd5e3 in dispatch_command (command=COM_QUERY, thd=0x7fc0e8a69060, packet=0x7fc0e8a6e061 "", packet_length=17) at /data/src/5.5/sql/sql_parse.cc:1066
      #18 0x00000000005fc7d5 in do_command (thd=0x7fc0e8a69060) at /data/src/5.5/sql/sql_parse.cc:793
      #19 0x00000000006ff7cf in do_handle_one_connection (thd_arg=0x7fc0e8a69060) at /data/src/5.5/sql/sql_connect.cc:1268
      #20 0x00000000006ff55c in handle_one_connection (arg=0x7fc0e8a69060) at /data/src/5.5/sql/sql_connect.cc:1184
      #21 0x0000000000a0d6d9 in pfs_spawn_thread (arg=0x7fc0e9793080) at /data/src/5.5/storage/perfschema/pfs.cc:1015
      #22 0x00007fc0ee525494 in start_thread (arg=0x7fc0ee8aa700) at pthread_create.c:333
      #23 0x00007fc0ecf3b93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            Couldn't repeat so I just added test case to 10.3

            monty Michael Widenius added a comment - Couldn't repeat so I just added test case to 10.3

            The problem disappeared from 10.0 tree (and higher after the merges) with this commit:

            commit a0702dbcda0c4495345d6dda6738cc77d823e325
            Author: Sergei Golubchik
            Date:   Tue Jan 23 11:24:53 2018 +0100
             
                MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S
                
                remove HA_EXTRA_PREPARE_FOR_RENAME - neither OPTIMIZE nor REPAIR need it
                (was introduced in b58e79566c5 when replacing remove_table_from_cache()
                with wait_while_table_is_used() even though remove_table_from_cache()
                did not have it).
            

            I'm not sure however whether it really fixes it, or just hides it.

            It's still reproducible on 5.5, but if 10.x are indeed fixed, there is no point fixing it in 5.5.

            elenst Elena Stepanova added a comment - The problem disappeared from 10.0 tree (and higher after the merges) with this commit: commit a0702dbcda0c4495345d6dda6738cc77d823e325 Author: Sergei Golubchik Date: Tue Jan 23 11:24:53 2018 +0100   MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S remove HA_EXTRA_PREPARE_FOR_RENAME - neither OPTIMIZE nor REPAIR need it (was introduced in b58e79566c5 when replacing remove_table_from_cache() with wait_while_table_is_used() even though remove_table_from_cache() did not have it). I'm not sure however whether it really fixes it, or just hides it. It's still reproducible on 5.5, but if 10.x are indeed fixed, there is no point fixing it in 5.5.

            Here is another test case which causes the same assertion failure on all current branches (5.5-10.3):

            CREATE TABLE t1 (a VARCHAR(255), FULLTEXT KEY(a)) ENGINE=Aria;
            CREATE TABLE t2 (b INT) ENGINE=Aria;
            LOCK TABLE t1 READ;
             
            --connect (con1,localhost,root,,test)
            INSERT INTO t2 VALUES (1);
            --connection default
            --error ER_TABLE_NOT_LOCKED
            DROP TABLE IF EXISTS non_existing_table;
            SELECT * FROM t1;
             
            # Cleanup
            UNLOCK TABLES;
            DROP TABLE t1, t2;
            --disconnect con1
            

            10.3 c2352c45fbd

            mysqld: /data/src/10.3/storage/maria/ha_maria.cc:2814: virtual int ha_maria::start_stmt(THD*, thr_lock_type): Assertion `file->trn == trn' failed.
            180517  3:21:21 [ERROR] mysqld got signal 6 ;
             
            #6  0x00007f9fcc2ed266 in __assert_fail_base (fmt=0x7f9fcc425f18 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f9fcf8cf7e2 "file->trn == trn", file=file@entry=0x7f9fcf8ced70 "/data/src/10.3/storage/maria/ha_maria.cc", line=line@entry=2814, function=function@entry=0x7f9fcf8d0320 <ha_maria::start_stmt(THD*, thr_lock_type)::__PRETTY_FUNCTION__> "virtual int ha_maria::start_stmt(THD*, thr_lock_type)") at assert.c:92
            #7  0x00007f9fcc2ed312 in __GI___assert_fail (assertion=0x7f9fcf8cf7e2 "file->trn == trn", file=0x7f9fcf8ced70 "/data/src/10.3/storage/maria/ha_maria.cc", line=2814, function=0x7f9fcf8d0320 <ha_maria::start_stmt(THD*, thr_lock_type)::__PRETTY_FUNCTION__> "virtual int ha_maria::start_stmt(THD*, thr_lock_type)") at assert.c:101
            #8  0x00007f9fcf35a114 in ha_maria::start_stmt (this=0x7f9fb4148598, thd=0x7f9fb4000b00, lock_type=TL_READ) at /data/src/10.3/storage/maria/ha_maria.cc:2814
            #9  0x00007f9fce9b70c0 in check_lock_and_start_stmt (thd=0x7f9fb4000b00, prelocking_ctx=0x7f9fb40048c0, table_list=0x7f9fb4014ed8) at /data/src/10.3/sql/sql_base.cc:4696
            #10 0x00007f9fce9b85e9 in lock_tables (thd=0x7f9fb4000b00, tables=0x7f9fb4014ed8, count=1, flags=0) at /data/src/10.3/sql/sql_base.cc:5267
            #11 0x00007f9fce9b7953 in open_and_lock_tables (thd=0x7f9fb4000b00, options=..., tables=0x7f9fb4014ed8, derived=true, flags=0, prelocking_strategy=0x7f9fc6665fc0) at /data/src/10.3/sql/sql_base.cc:4930
            #12 0x00007f9fce97828f in open_and_lock_tables (thd=0x7f9fb4000b00, tables=0x7f9fb4014ed8, derived=true, flags=0) at /data/src/10.3/sql/sql_base.h:492
            #13 0x00007f9fcea4ab1d in execute_sqlcom_select (thd=0x7f9fb4000b00, all_tables=0x7f9fb4014ed8) at /data/src/10.3/sql/sql_parse.cc:6466
            #14 0x00007f9fcea41688 in mysql_execute_command (thd=0x7f9fb4000b00) at /data/src/10.3/sql/sql_parse.cc:3768
            #15 0x00007f9fcea4ecd1 in mysql_parse (thd=0x7f9fb4000b00, rawbuf=0x7f9fb4014ce8 "SELECT * FROM t1", length=16, parser_state=0x7f9fc66675e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8019
            #16 0x00007f9fcea3c113 in dispatch_command (command=COM_QUERY, thd=0x7f9fb4000b00, packet=0x7f9fb400b1f1 "SELECT * FROM t1", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1846
            #17 0x00007f9fcea3ab37 in do_command (thd=0x7f9fb4000b00) at /data/src/10.3/sql/sql_parse.cc:1391
            #18 0x00007f9fceb9febb in do_handle_one_connection (connect=0x7f9fd1d0f320) at /data/src/10.3/sql/sql_connect.cc:1402
            #19 0x00007f9fceb9fc3f in handle_one_connection (arg=0x7f9fd1d0f320) at /data/src/10.3/sql/sql_connect.cc:1308
            #20 0x00007f9fcef55f69 in pfs_spawn_thread (arg=0x7f9fd1d22bc0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
            #21 0x00007f9fcdf54064 in start_thread (arg=0x7f9fc6668700) at pthread_create.c:309
            #22 0x00007f9fcc3a762d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
            

            elenst Elena Stepanova added a comment - Here is another test case which causes the same assertion failure on all current branches (5.5-10.3): CREATE TABLE t1 (a VARCHAR (255), FULLTEXT KEY (a)) ENGINE=Aria; CREATE TABLE t2 (b INT ) ENGINE=Aria; LOCK TABLE t1 READ ;   --connect (con1,localhost,root,,test) INSERT INTO t2 VALUES (1); --connection default --error ER_TABLE_NOT_LOCKED DROP TABLE IF EXISTS non_existing_table; SELECT * FROM t1;   # Cleanup UNLOCK TABLES; DROP TABLE t1, t2; --disconnect con1 10.3 c2352c45fbd mysqld: /data/src/10.3/storage/maria/ha_maria.cc:2814: virtual int ha_maria::start_stmt(THD*, thr_lock_type): Assertion `file->trn == trn' failed. 180517 3:21:21 [ERROR] mysqld got signal 6 ;   #6 0x00007f9fcc2ed266 in __assert_fail_base (fmt=0x7f9fcc425f18 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f9fcf8cf7e2 "file->trn == trn", file=file@entry=0x7f9fcf8ced70 "/data/src/10.3/storage/maria/ha_maria.cc", line=line@entry=2814, function=function@entry=0x7f9fcf8d0320 <ha_maria::start_stmt(THD*, thr_lock_type)::__PRETTY_FUNCTION__> "virtual int ha_maria::start_stmt(THD*, thr_lock_type)") at assert.c:92 #7 0x00007f9fcc2ed312 in __GI___assert_fail (assertion=0x7f9fcf8cf7e2 "file->trn == trn", file=0x7f9fcf8ced70 "/data/src/10.3/storage/maria/ha_maria.cc", line=2814, function=0x7f9fcf8d0320 <ha_maria::start_stmt(THD*, thr_lock_type)::__PRETTY_FUNCTION__> "virtual int ha_maria::start_stmt(THD*, thr_lock_type)") at assert.c:101 #8 0x00007f9fcf35a114 in ha_maria::start_stmt (this=0x7f9fb4148598, thd=0x7f9fb4000b00, lock_type=TL_READ) at /data/src/10.3/storage/maria/ha_maria.cc:2814 #9 0x00007f9fce9b70c0 in check_lock_and_start_stmt (thd=0x7f9fb4000b00, prelocking_ctx=0x7f9fb40048c0, table_list=0x7f9fb4014ed8) at /data/src/10.3/sql/sql_base.cc:4696 #10 0x00007f9fce9b85e9 in lock_tables (thd=0x7f9fb4000b00, tables=0x7f9fb4014ed8, count=1, flags=0) at /data/src/10.3/sql/sql_base.cc:5267 #11 0x00007f9fce9b7953 in open_and_lock_tables (thd=0x7f9fb4000b00, options=..., tables=0x7f9fb4014ed8, derived=true, flags=0, prelocking_strategy=0x7f9fc6665fc0) at /data/src/10.3/sql/sql_base.cc:4930 #12 0x00007f9fce97828f in open_and_lock_tables (thd=0x7f9fb4000b00, tables=0x7f9fb4014ed8, derived=true, flags=0) at /data/src/10.3/sql/sql_base.h:492 #13 0x00007f9fcea4ab1d in execute_sqlcom_select (thd=0x7f9fb4000b00, all_tables=0x7f9fb4014ed8) at /data/src/10.3/sql/sql_parse.cc:6466 #14 0x00007f9fcea41688 in mysql_execute_command (thd=0x7f9fb4000b00) at /data/src/10.3/sql/sql_parse.cc:3768 #15 0x00007f9fcea4ecd1 in mysql_parse (thd=0x7f9fb4000b00, rawbuf=0x7f9fb4014ce8 "SELECT * FROM t1", length=16, parser_state=0x7f9fc66675e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8019 #16 0x00007f9fcea3c113 in dispatch_command (command=COM_QUERY, thd=0x7f9fb4000b00, packet=0x7f9fb400b1f1 "SELECT * FROM t1", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1846 #17 0x00007f9fcea3ab37 in do_command (thd=0x7f9fb4000b00) at /data/src/10.3/sql/sql_parse.cc:1391 #18 0x00007f9fceb9febb in do_handle_one_connection (connect=0x7f9fd1d0f320) at /data/src/10.3/sql/sql_connect.cc:1402 #19 0x00007f9fceb9fc3f in handle_one_connection (arg=0x7f9fd1d0f320) at /data/src/10.3/sql/sql_connect.cc:1308 #20 0x00007f9fcef55f69 in pfs_spawn_thread (arg=0x7f9fd1d22bc0) at /data/src/10.3/storage/perfschema/pfs.cc:1862 #21 0x00007f9fcdf54064 in start_thread (arg=0x7f9fc6668700) at pthread_create.c:309 #22 0x00007f9fcc3a762d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

            Was fixed as part of commit for MDEV-10130

            monty Michael Widenius added a comment - Was fixed as part of commit for MDEV-10130

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.