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

Assertion `trx->bulk_insert' failed in trx_undo_report_row_operation on INSERT

Details

    Description

      Discussed with marko. Further to MDEV-25315.

      SET foreign_key_checks=0,unique_checks=0;
      CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 3;
      INSERT INTO t VALUES (0);
      INSERT INTO t VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
      

      Leads to:

      10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

      mysqld: /test/10.6_dbg/storage/innobase/trx/trx0rec.cc:2037: dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*): Assertion `trx->bulk_insert' failed.
      

      10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

      Core was generated by `/test/MD150421-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x1539dc162700 (LWP 3412208))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001539f11d1859 in __GI_abort () at abort.c:79
      #2  0x00001539f11d1729 in __assert_fail_base (fmt=0x1539f1367588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55a1988f4c55 "trx->bulk_insert", file=0x55a1988f4d70 "/test/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=2037, function=<optimized out>) at assert.c:92
      #3  0x00001539f11e2f36 in __GI___assert_fail (assertion=assertion@entry=0x55a1988f4c55 "trx->bulk_insert", file=file@entry=0x55a1988f4d70 "/test/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=line@entry=2037, function=function@entry=0x55a1988f58f8 "dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*)") at assert.c:101
      #4  0x000055a1982985b7 in trx_undo_report_row_operation (thr=thr@entry=0x153998038a40, index=index@entry=0x15399802a5d8, clust_entry=clust_entry@entry=0x153998027a38, update=update@entry=0x0, cmpl_info=cmpl_info@entry=0, rec=rec@entry=0x0, offsets=0x0, roll_ptr=0x1539dc15f060) at /test/10.6_dbg/storage/innobase/trx/trx0rec.cc:2037
      #5  0x000055a1982f4c9f in btr_cur_ins_lock_and_undo (flags=flags@entry=0, cursor=cursor@entry=0x1539dc15f570, entry=entry@entry=0x153998027a38, thr=thr@entry=0x153998038a40, mtr=mtr@entry=0x1539dc15fb20, inherit=inherit@entry=0x1539dc15f147) at /test/10.6_dbg/storage/innobase/btr/btr0cur.cc:3299
      #6  0x000055a1982fb79f in btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x1539dc15f570, offsets=offsets@entry=0x1539dc15f538, heap=heap@entry=0x1539dc15f530, entry=entry@entry=0x153998027a38, rec=rec@entry=0x1539dc15f548, big_rec=0x1539dc15f528, n_ext=<optimized out>, thr=0x153998038a40, mtr=0x1539dc15fb20) at /test/10.6_dbg/storage/innobase/btr/btr0cur.cc:3526
      #7  0x000055a1981d476c in row_ins_clust_index_entry_low (flags=flags@entry=0, mode=<optimized out>, mode@entry=2, index=index@entry=0x15399802a5d8, n_uniq=n_uniq@entry=0, entry=entry@entry=0x153998027a38, n_ext=n_ext@entry=0, thr=<optimized out>) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:2790
      #8  0x000055a1981d6331 in row_ins_clust_index_entry (index=index@entry=0x15399802a5d8, entry=entry@entry=0x153998027a38, thr=thr@entry=0x153998038a40, n_ext=n_ext@entry=0) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3263
      #9  0x000055a1981daf0a in row_ins_index_entry (thr=0x153998038a40, entry=0x153998027a38, index=0x15399802a5d8) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3388
      #10 row_ins_index_entry_step (thr=0x153998038a40, node=0x153998038828) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3557
      #11 row_ins (thr=0x153998038a40, node=0x153998038828) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3703
      #12 row_ins_step (thr=thr@entry=0x153998038a40) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3845
      #13 0x000055a1981ff8e0 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x153998024d28 "\375C", prebuilt=0x153998038338, ins_mode=ROW_INS_NORMAL) at /test/10.6_dbg/storage/innobase/row/row0mysql.cc:1395
      #14 0x000055a19808573a in ha_innobase::write_row (this=0x153998033350, record=0x153998024d28 "\375C") at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:7424
      #15 0x000055a197c90f0d in handler::ha_write_row (this=0x153998033350, buf=buf@entry=0x153998024d28 "\375C") at /test/10.6_dbg/sql/handler.cc:7156
      #16 0x000055a197fb79d1 in ha_partition::write_row (this=0x153998032200, buf=0x153998024d28 "\375C") at /test/10.6_dbg/sql/ha_partition.cc:4475
      #17 0x000055a197c90f0d in handler::ha_write_row (this=0x153998032200, buf=0x153998024d28 "\375C") at /test/10.6_dbg/sql/handler.cc:7156
      #18 0x000055a19796abfd in write_record (thd=thd@entry=0x153998000db8, table=table@entry=0x15399801f838, info=info@entry=0x1539dc160d00, sink=sink@entry=0x0) at /test/10.6_dbg/sql/sql_insert.cc:2106
      #19 0x000055a197976474 in mysql_insert (thd=thd@entry=0x153998000db8, table_list=0x153998013cf0, fields=@0x153998005e60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a198f8c280 <end_of_list>, last = 0x153998005e60, elements = 0}, <No data fields>}, values_list=@0x153998005ea8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153998014928, last = 0x153998014f10, elements = 8}, <No data fields>}, update_fields=@0x153998005e90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a198f8c280 <end_of_list>, last = 0x153998005e90, elements = 0}, <No data fields>}, update_values=@0x153998005e78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a198f8c280 <end_of_list>, last = 0x153998005e78, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:1099
      #20 0x000055a1979bd1ac in mysql_execute_command (thd=thd@entry=0x153998000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
      #21 0x000055a1979a7a06 in mysql_parse (thd=thd@entry=0x153998000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1539dc161410) at /test/10.6_dbg/sql/sql_parse.cc:8017
      #22 0x000055a1979b67df in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153998000db8, packet=packet@entry=0x15399800b369 "INSERT INTO t VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47)", packet_length=packet_length@entry=76, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1331
      #23 0x000055a1979b9bd5 in do_command (thd=0x153998000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
      #24 0x000055a197b1377c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55a19ab7a6e8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #25 0x000055a197b13d81 in handle_one_connection (arg=arg@entry=0x55a19ab7a6e8) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #26 0x000055a197fc1a03 in pfs_spawn_thread (arg=0x55a19aa90aa8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #27 0x00001539f16df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00001539f12ce293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      10.6.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (dbg), 10.4.19 (opt), 10.5.10 (dbg), 10.5.10 (opt), 10.6.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)

      Attachments

        Issue Links

          Activity

            The following code in InnoDB works around the lack of ha_innobase::start_stmt() calls. Other assignments to clear bulk_insert seem to be necessary even if the missing calls to ha_innobase::start_stmt() are added:

            diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
            index 4adc279fb32..bb85e82cbb8 100644
            --- a/storage/innobase/row/row0mysql.cc
            +++ b/storage/innobase/row/row0mysql.cc
            @@ -1051,13 +1051,6 @@ row_get_prebuilt_insert_row(
             		if (prebuilt->trx_id == table->def_trx_id
             		    && prebuilt->ins_node->entry_list.size()
             		    == UT_LIST_GET_LEN(table->indexes)) {
            -
            -			if (prebuilt->trx->bulk_insert
            -			    && prebuilt->ins_node->trx_id
            -			       != prebuilt->trx->id) {
            -				prebuilt->trx->bulk_insert = false;
            -			}
            -
             			return(prebuilt->ins_node->row);
             		}
             
            

            marko Marko Mäkelä added a comment - The following code in InnoDB works around the lack of ha_innobase::start_stmt() calls. Other assignments to clear bulk_insert seem to be necessary even if the missing calls to ha_innobase::start_stmt() are added: diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 4adc279fb32..bb85e82cbb8 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1051,13 +1051,6 @@ row_get_prebuilt_insert_row( if (prebuilt->trx_id == table->def_trx_id && prebuilt->ins_node->entry_list.size() == UT_LIST_GET_LEN(table->indexes)) { - - if (prebuilt->trx->bulk_insert - && prebuilt->ins_node->trx_id - != prebuilt->trx->id) { - prebuilt->trx->bulk_insert = false; - } - return(prebuilt->ins_node->row); }

            Though handler::start_stmt is not called, handler::ha_external_lock is, so `innobase_register_trx` is reached anyway.

            Therefore the problem seems to be not in the transaction/statement boundary detection.

            I am not proficient in bulk insertion mechanics to proceed further, so assigning back

            nikitamalyavin Nikita Malyavin added a comment - Though handler::start_stmt is not called, handler::ha_external_lock is, so `innobase_register_trx` is reached anyway. Therefore the problem seems to be not in the transaction/statement boundary detection. I am not proficient in bulk insertion mechanics to proceed further, so assigning back

            nikitamalyavin, the calls to indicate statement boundaries are outside the InnoDB storage engine. I think that this must be fixed in the server core layer in a satisfactory way. I merely indicated where InnoDB includes one work-around for a missing call to ha_innobase::start_stmt(). If some code around versioned tables will have to be adjusted, I would like to point out that also that code is outside the InnoDB storage engine.

            marko Marko Mäkelä added a comment - nikitamalyavin , the calls to indicate statement boundaries are outside the InnoDB storage engine. I think that this must be fixed in the server core layer in a satisfactory way. I merely indicated where InnoDB includes one work-around for a missing call to ha_innobase::start_stmt() . If some code around versioned tables will have to be adjusted, I would like to point out that also that code is outside the InnoDB storage engine.

            marko The boundaries are detected for both inserts in both plain CREATE TABLE and PARTITION one.
            The gdb outputs indicate that even for plain CREATE TABLE trx->bulk_insert is set to false:
            We can also note that ha_external_lock is called 4 times: 2 for each INSERT statement, indicating lock and unlock respectively:

            Thread 2 hit Breakpoint 5, mysql_create_table (thd=0x555a2488ee68, create_table=0x555a248a10a8, create_info=0x7fb5002a2e50, alter_info=0x7fb5002a2d68) at ../sql/sql_table.cc:4602
            4602	  TABLE_LIST *pos_in_locked_tables= 0;
            (gdb) bt
            #0  mysql_create_table (thd=0x555a2488ee68, create_table=0x555a248a10a8, create_info=0x7fb5002a2e50, alter_info=0x7fb5002a2d68) at ../sql/sql_table.cc:4602
            #1  0x0000555a21357ca1 in Sql_cmd_create_table_like::execute (this=0x555a248a1048, thd=0x555a2488ee68) at ../sql/sql_table.cc:11770
            #2  0x0000555a21228a67 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:5983
            #3  0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "CREATE TABLE t (i INT) ENGINE=InnoDB", length=36, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016
            #4  0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "CREATE TABLE t (i INT) ENGINE=InnoDB", packet_length=36, blocking=true) at ../sql/sql_parse.cc:1897
            #5  0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406
            #6  0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #7  0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312
            #8  0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201
            #9  0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0
            #10 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6
             
             
            (gdb) n
            4603	  MDL_ticket *mdl_ticket= 0;
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 2, mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711
            711	  Name_resolution_context_state ctx_state;
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x0000555a217e6fdb in lock_external (thd=0x555a2488ee68, tables=0x555a248a2698, count=1) at ../sql/lock.cc:393
            #3  0x0000555a217e6aee in mysql_lock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678, flags=0) at ../sql/lock.cc:338
            #4  0x0000555a217e5b1d in mysql_lock_tables (thd=0x555a2488ee68, tables=0x555a248a2670, count=1, flags=0) at ../sql/lock.cc:301
            #5  0x0000555a2114a57c in lock_tables (thd=0x555a2488ee68, tables=0x555a248a1078, count=1, flags=0) at ../sql/sql_base.cc:5538
            #6  0x0000555a2114bcb4 in open_and_lock_tables (thd=0x555a2488ee68, options=..., tables=0x555a248a1078, derived=true, flags=0, prelocking_strategy=0x7fb5002a2ae0) at ../sql/sql_base.cc:5250
            #7  0x0000555a210edc70 in open_and_lock_tables (thd=0x555a2488ee68, tables=0x555a248a1078, derived=true, flags=0) at ../sql/sql_base.h:509
            #8  0x0000555a211b51b8 in mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #9  0x0000555a21221179 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:4556
            #10 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016
            #11 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #12 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406
            #13 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #14 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312
            #15 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201
            #16 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0
            #17 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $1 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../sql/handler.cc:6770
            #2  0x0000555a2135d712 in handler::ha_external_unlock (this=0x555a24996ff0, thd=0x555a2488ee68) at ../sql/handler.h:3532
            #3  0x0000555a217e71a1 in unlock_external (thd=0x555a2488ee68, table=0x555a248a2698, count=1) at ../sql/lock.cc:727
            #4  0x0000555a217e7346 in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678, free_lock=false) at ../sql/lock.cc:432
            #5  0x0000555a217e75ee in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678) at ../sql/lock.cc:415
            #6  0x0000555a2114028f in close_thread_tables (thd=0x555a2488ee68) at ../sql/sql_base.cc:913
            #7  0x0000555a21228fee in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:6049
            #8  0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016
            #9  0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #10 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406
            #11 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #12 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312
            #13 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201
            #14 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0
            #15 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $2 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 2, mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711
            711	  Name_resolution_context_state ctx_state;
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x0000555a217e6fdb in lock_external (thd=0x555a2488ee68, tables=0x555a248a2818, count=1) at ../sql/lock.cc:393
            #3  0x0000555a217e6aee in mysql_lock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8, flags=0) at ../sql/lock.cc:338
            #4  0x0000555a217e5b1d in mysql_lock_tables (thd=0x555a2488ee68, tables=0x555a248a27f0, count=1, flags=0) at ../sql/lock.cc:301
            #5  0x0000555a2114a57c in lock_tables (thd=0x555a2488ee68, tables=0x555a248a1088, count=1, flags=0) at ../sql/sql_base.cc:5538
            #6  0x0000555a2114bcb4 in open_and_lock_tables (thd=0x555a2488ee68, options=..., tables=0x555a248a1088, derived=true, flags=0, prelocking_strategy=0x7fb5002a2ae0) at ../sql/sql_base.cc:5250
            #7  0x0000555a210edc70 in open_and_lock_tables (thd=0x555a2488ee68, tables=0x555a248a1088, derived=true, flags=0) at ../sql/sql_base.h:509
            #8  0x0000555a211b51b8 in mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #9  0x0000555a21221179 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:4556
            #10 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016
            #11 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897
            #12 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406
            #13 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #14 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312
            #15 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201
            #16 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0
            #17 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $3 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) p trx->bulk_insert
            $4 = false
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../sql/handler.cc:6770
            #2  0x0000555a2135d712 in handler::ha_external_unlock (this=0x555a24996ff0, thd=0x555a2488ee68) at ../sql/handler.h:3532
            #3  0x0000555a217e71a1 in unlock_external (thd=0x555a2488ee68, table=0x555a248a2818, count=1) at ../sql/lock.cc:727
            #4  0x0000555a217e7346 in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8, free_lock=false) at ../sql/lock.cc:432
            #5  0x0000555a217e75ee in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8) at ../sql/lock.cc:415
            #6  0x0000555a2114028f in close_thread_tables (thd=0x555a2488ee68) at ../sql/sql_base.cc:913
            #7  0x0000555a21228fee in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:6049
            #8  0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016
            #9  0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897
            #10 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406
            #11 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #12 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312
            #13 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201
            #14 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0
            #15 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6
            

            The PARTITION case outputs look the same. The difference is that ha_innobase:::external_lock is called 4 times for the statement, one lock/unlock pair for each partition. The second statement aborts:

            Thread 2 hit Breakpoint 6, mysql_create_table (thd=0x55892a79ae68, create_table=0x55892a7ad0e8, create_info=0x7f00cc059e50, alter_info=0x7f00cc059d68) at ../sql/sql_table.cc:4602
            4602	  TABLE_LIST *pos_in_locked_tables= 0;
            (gdb) p thd->query()
            $1 = 0x55892a7acfa0 "CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2"
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 2, mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711
            711	  Name_resolution_context_state ctx_state;
            (gdb) p thd->query()
            $2 = 0x55892a7acfa0 "INSERT INTO t VALUES (0)"
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #4  0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae698, count=1) at ../sql/lock.cc:393
            #5  0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, flags=0) at ../sql/lock.cc:338
            #6  0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae670, count=1, flags=0) at ../sql/lock.cc:301
            #7  0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, count=1, flags=0) at ../sql/sql_base.cc:5538
            #8  0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad078, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250
            #9  0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, derived=true, flags=0) at ../sql/sql_base.h:509
            #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556
            #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
             
             
            (gdb) p trx->bulk_insert
            $3 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #4  0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae698, count=1) at ../sql/lock.cc:393
            #5  0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, flags=0) at ../sql/lock.cc:338
            #6  0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae670, count=1, flags=0) at ../sql/lock.cc:301
            #7  0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, count=1, flags=0) at ../sql/sql_base.cc:5538
            #8  0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad078, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250
            #9  0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, derived=true, flags=0) at ../sql/sql_base.h:509
            #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556
            #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $4 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770
            #4  0x0000558926dfc712 in handler::ha_external_unlock (this=0x55892a9ac490, thd=0x55892a79ae68) at ../sql/handler.h:3532
            #5  0x00005589272861a1 in unlock_external (thd=0x55892a79ae68, table=0x55892a7ae698, count=1) at ../sql/lock.cc:727
            #6  0x0000558927286346 in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, free_lock=false) at ../sql/lock.cc:432
            #7  0x00005589272865ee in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678) at ../sql/lock.cc:415
            #8  0x0000558926bdf28f in close_thread_tables (thd=0x55892a79ae68) at ../sql/sql_base.cc:913
            #9  0x0000558926cc7fee in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:6049
            #10 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #11 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #12 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #13 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #14 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #15 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #16 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #17 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $5 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770
            #4  0x0000558926dfc712 in handler::ha_external_unlock (this=0x55892a9ac490, thd=0x55892a79ae68) at ../sql/handler.h:3532
            #5  0x00005589272861a1 in unlock_external (thd=0x55892a79ae68, table=0x55892a7ae698, count=1) at ../sql/lock.cc:727
            #6  0x0000558927286346 in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, free_lock=false) at ../sql/lock.cc:432
            #7  0x00005589272865ee in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678) at ../sql/lock.cc:415
            #8  0x0000558926bdf28f in close_thread_tables (thd=0x55892a79ae68) at ../sql/sql_base.cc:913
            #9  0x0000558926cc7fee in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:6049
            #10 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #11 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897
            #12 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #13 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #14 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #15 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #16 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #17 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $6 = false
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 2, mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711
            711	  Name_resolution_context_state ctx_state;
            (gdb) p thd->query()
            $7 = 0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)"
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) p trx->bulk_insert
            $8 = false
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #4  0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae818, count=1) at ../sql/lock.cc:393
            #5  0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae7f8, flags=0) at ../sql/lock.cc:338
            #6  0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae7f0, count=1, flags=0) at ../sql/lock.cc:301
            #7  0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, count=1, flags=0) at ../sql/sql_base.cc:5538
            #8  0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad088, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250
            #9  0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, derived=true, flags=0) at ../sql/sql_base.h:509
            #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556
            #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897
            #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
            (gdb) c
            Continuing.
             
            Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            15483		switch (sql_command) {
            (gdb) bt
            #0  ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483
            #1  0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #2  0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072
            #3  0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770
            #4  0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae818, count=1) at ../sql/lock.cc:393
            #5  0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae7f8, flags=0) at ../sql/lock.cc:338
            #6  0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae7f0, count=1, flags=0) at ../sql/lock.cc:301
            #7  0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, count=1, flags=0) at ../sql/sql_base.cc:5538
            #8  0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad088, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250
            #9  0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, derived=true, flags=0) at ../sql/sql_base.h:509
            #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756
            #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556
            #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016
            #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897
            #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406
            #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410
            #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312
            #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201
            #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0
            #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6
            (gdb) p trx->bulk_insert
            $9 = false
            (gdb) c
            Continuing.
             
            Thread 2 received signal SIGABRT, Aborted.
            0x00007f00d4400ef5 in raise () from /usr/lib/libc.so.6
            

            nikitamalyavin Nikita Malyavin added a comment - marko The boundaries are detected for both inserts in both plain CREATE TABLE and PARTITION one. The gdb outputs indicate that even for plain CREATE TABLE trx->bulk_insert is set to false: We can also note that ha_external_lock is called 4 times: 2 for each INSERT statement, indicating lock and unlock respectively: Thread 2 hit Breakpoint 5, mysql_create_table (thd=0x555a2488ee68, create_table=0x555a248a10a8, create_info=0x7fb5002a2e50, alter_info=0x7fb5002a2d68) at ../sql/sql_table.cc:4602 4602 TABLE_LIST *pos_in_locked_tables= 0; (gdb) bt #0 mysql_create_table (thd=0x555a2488ee68, create_table=0x555a248a10a8, create_info=0x7fb5002a2e50, alter_info=0x7fb5002a2d68) at ../sql/sql_table.cc:4602 #1 0x0000555a21357ca1 in Sql_cmd_create_table_like::execute (this=0x555a248a1048, thd=0x555a2488ee68) at ../sql/sql_table.cc:11770 #2 0x0000555a21228a67 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:5983 #3 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "CREATE TABLE t (i INT) ENGINE=InnoDB", length=36, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016 #4 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "CREATE TABLE t (i INT) ENGINE=InnoDB", packet_length=36, blocking=true) at ../sql/sql_parse.cc:1897 #5 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406 #6 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #7 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312 #8 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201 #9 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0 #10 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6     (gdb) n 4603 MDL_ticket *mdl_ticket= 0; (gdb) c Continuing.   Thread 2 hit Breakpoint 2, mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711 711 Name_resolution_context_state ctx_state; (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../sql/handler.cc:6770 #2 0x0000555a217e6fdb in lock_external (thd=0x555a2488ee68, tables=0x555a248a2698, count=1) at ../sql/lock.cc:393 #3 0x0000555a217e6aee in mysql_lock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678, flags=0) at ../sql/lock.cc:338 #4 0x0000555a217e5b1d in mysql_lock_tables (thd=0x555a2488ee68, tables=0x555a248a2670, count=1, flags=0) at ../sql/lock.cc:301 #5 0x0000555a2114a57c in lock_tables (thd=0x555a2488ee68, tables=0x555a248a1078, count=1, flags=0) at ../sql/sql_base.cc:5538 #6 0x0000555a2114bcb4 in open_and_lock_tables (thd=0x555a2488ee68, options=..., tables=0x555a248a1078, derived=true, flags=0, prelocking_strategy=0x7fb5002a2ae0) at ../sql/sql_base.cc:5250 #7 0x0000555a210edc70 in open_and_lock_tables (thd=0x555a2488ee68, tables=0x555a248a1078, derived=true, flags=0) at ../sql/sql_base.h:509 #8 0x0000555a211b51b8 in mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #9 0x0000555a21221179 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:4556 #10 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016 #11 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #12 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406 #13 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #14 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312 #15 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201 #16 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0 #17 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $1 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../sql/handler.cc:6770 #2 0x0000555a2135d712 in handler::ha_external_unlock (this=0x555a24996ff0, thd=0x555a2488ee68) at ../sql/handler.h:3532 #3 0x0000555a217e71a1 in unlock_external (thd=0x555a2488ee68, table=0x555a248a2698, count=1) at ../sql/lock.cc:727 #4 0x0000555a217e7346 in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678, free_lock=false) at ../sql/lock.cc:432 #5 0x0000555a217e75ee in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a2678) at ../sql/lock.cc:415 #6 0x0000555a2114028f in close_thread_tables (thd=0x555a2488ee68) at ../sql/sql_base.cc:913 #7 0x0000555a21228fee in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:6049 #8 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016 #9 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #10 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406 #11 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #12 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312 #13 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201 #14 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0 #15 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $2 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 2, mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711 711 Name_resolution_context_state ctx_state; (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=1) at ../sql/handler.cc:6770 #2 0x0000555a217e6fdb in lock_external (thd=0x555a2488ee68, tables=0x555a248a2818, count=1) at ../sql/lock.cc:393 #3 0x0000555a217e6aee in mysql_lock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8, flags=0) at ../sql/lock.cc:338 #4 0x0000555a217e5b1d in mysql_lock_tables (thd=0x555a2488ee68, tables=0x555a248a27f0, count=1, flags=0) at ../sql/lock.cc:301 #5 0x0000555a2114a57c in lock_tables (thd=0x555a2488ee68, tables=0x555a248a1088, count=1, flags=0) at ../sql/sql_base.cc:5538 #6 0x0000555a2114bcb4 in open_and_lock_tables (thd=0x555a2488ee68, options=..., tables=0x555a248a1088, derived=true, flags=0, prelocking_strategy=0x7fb5002a2ae0) at ../sql/sql_base.cc:5250 #7 0x0000555a210edc70 in open_and_lock_tables (thd=0x555a2488ee68, tables=0x555a248a1088, derived=true, flags=0) at ../sql/sql_base.h:509 #8 0x0000555a211b51b8 in mysql_insert (thd=0x555a2488ee68, table_list=0x555a248a1088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #9 0x0000555a21221179 in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:4556 #10 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016 #11 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897 #12 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406 #13 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #14 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312 #15 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201 #16 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0 #17 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $3 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) p trx->bulk_insert $4 = false (gdb) bt #0 ha_innobase::external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x0000555a21641d0a in handler::ha_external_lock (this=0x555a24996ff0, thd=0x555a2488ee68, lock_type=2) at ../sql/handler.cc:6770 #2 0x0000555a2135d712 in handler::ha_external_unlock (this=0x555a24996ff0, thd=0x555a2488ee68) at ../sql/handler.h:3532 #3 0x0000555a217e71a1 in unlock_external (thd=0x555a2488ee68, table=0x555a248a2818, count=1) at ../sql/lock.cc:727 #4 0x0000555a217e7346 in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8, free_lock=false) at ../sql/lock.cc:432 #5 0x0000555a217e75ee in mysql_unlock_tables (thd=0x555a2488ee68, sql_lock=0x555a248a27f8) at ../sql/lock.cc:415 #6 0x0000555a2114028f in close_thread_tables (thd=0x555a2488ee68) at ../sql/sql_base.cc:913 #7 0x0000555a21228fee in mysql_execute_command (thd=0x555a2488ee68) at ../sql/sql_parse.cc:6049 #8 0x0000555a21214821 in mysql_parse (thd=0x555a2488ee68, rawbuf=0x555a248a0fa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7fb5002a52d8) at ../sql/sql_parse.cc:8016 #9 0x0000555a212110b2 in dispatch_command (command=COM_QUERY, thd=0x555a2488ee68, packet=0x555a24897ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897 #10 0x0000555a21215ad5 in do_command (thd=0x555a2488ee68, blocking=true) at ../sql/sql_parse.cc:1406 #11 0x0000555a2141df24 in do_handle_one_connection (connect=0x555a2484f5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #12 0x0000555a2141dc5a in handle_one_connection (arg=0x555a2483d998) at ../sql/sql_connect.cc:1312 #13 0x0000555a21a51349 in pfs_spawn_thread (arg=0x555a24797f98) at ../storage/perfschema/pfs.cc:2201 #14 0x00007fb50ea03299 in start_thread () from /usr/lib/libpthread.so.0 #15 0x00007fb50e72c053 in clone () from /usr/lib/libc.so.6 The PARTITION case outputs look the same. The difference is that ha_innobase:::external_lock is called 4 times for the statement, one lock/unlock pair for each partition. The second statement aborts: Thread 2 hit Breakpoint 6, mysql_create_table (thd=0x55892a79ae68, create_table=0x55892a7ad0e8, create_info=0x7f00cc059e50, alter_info=0x7f00cc059d68) at ../sql/sql_table.cc:4602 4602 TABLE_LIST *pos_in_locked_tables= 0; (gdb) p thd->query() $1 = 0x55892a7acfa0 "CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2" (gdb) c Continuing.   Thread 2 hit Breakpoint 2, mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711 711 Name_resolution_context_state ctx_state; (gdb) p thd->query() $2 = 0x55892a7acfa0 "INSERT INTO t VALUES (0)" (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #4 0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae698, count=1) at ../sql/lock.cc:393 #5 0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, flags=0) at ../sql/lock.cc:338 #6 0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae670, count=1, flags=0) at ../sql/lock.cc:301 #7 0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, count=1, flags=0) at ../sql/sql_base.cc:5538 #8 0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad078, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250 #9 0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, derived=true, flags=0) at ../sql/sql_base.h:509 #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556 #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6     (gdb) p trx->bulk_insert $3 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #4 0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae698, count=1) at ../sql/lock.cc:393 #5 0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, flags=0) at ../sql/lock.cc:338 #6 0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae670, count=1, flags=0) at ../sql/lock.cc:301 #7 0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, count=1, flags=0) at ../sql/sql_base.cc:5538 #8 0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad078, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250 #9 0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad078, derived=true, flags=0) at ../sql/sql_base.h:509 #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad078, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556 #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $4 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770 #4 0x0000558926dfc712 in handler::ha_external_unlock (this=0x55892a9ac490, thd=0x55892a79ae68) at ../sql/handler.h:3532 #5 0x00005589272861a1 in unlock_external (thd=0x55892a79ae68, table=0x55892a7ae698, count=1) at ../sql/lock.cc:727 #6 0x0000558927286346 in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, free_lock=false) at ../sql/lock.cc:432 #7 0x00005589272865ee in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678) at ../sql/lock.cc:415 #8 0x0000558926bdf28f in close_thread_tables (thd=0x55892a79ae68) at ../sql/sql_base.cc:913 #9 0x0000558926cc7fee in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:6049 #10 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #11 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #12 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #13 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #14 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #15 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #16 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #17 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $5 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=2) at ../sql/handler.cc:6770 #4 0x0000558926dfc712 in handler::ha_external_unlock (this=0x55892a9ac490, thd=0x55892a79ae68) at ../sql/handler.h:3532 #5 0x00005589272861a1 in unlock_external (thd=0x55892a79ae68, table=0x55892a7ae698, count=1) at ../sql/lock.cc:727 #6 0x0000558927286346 in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678, free_lock=false) at ../sql/lock.cc:432 #7 0x00005589272865ee in mysql_unlock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae678) at ../sql/lock.cc:415 #8 0x0000558926bdf28f in close_thread_tables (thd=0x55892a79ae68) at ../sql/sql_base.cc:913 #9 0x0000558926cc7fee in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:6049 #10 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (0)", length=24, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #11 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (0)", packet_length=24, blocking=true) at ../sql/sql_parse.cc:1897 #12 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #13 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #14 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #15 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #16 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #17 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $6 = false (gdb) c Continuing.   Thread 2 hit Breakpoint 2, mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:711 711 Name_resolution_context_state ctx_state; (gdb) p thd->query() $7 = 0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)" (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) p trx->bulk_insert $8 = false (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9acd00, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #4 0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae818, count=1) at ../sql/lock.cc:393 #5 0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae7f8, flags=0) at ../sql/lock.cc:338 #6 0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae7f0, count=1, flags=0) at ../sql/lock.cc:301 #7 0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, count=1, flags=0) at ../sql/sql_base.cc:5538 #8 0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad088, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250 #9 0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, derived=true, flags=0) at ../sql/sql_base.h:509 #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556 #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897 #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6 (gdb) c Continuing.   Thread 2 hit Breakpoint 3, ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 15483 switch (sql_command) { (gdb) bt #0 ha_innobase::external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../storage/innobase/handler/ha_innodb.cc:15483 #1 0x00005589270e0d72 in handler::ha_external_lock (this=0x55892a9ad4e0, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #2 0x00005589274cf253 in ha_partition::external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/ha_partition.cc:4072 #3 0x00005589270e0d0a in handler::ha_external_lock (this=0x55892a9ac490, thd=0x55892a79ae68, lock_type=1) at ../sql/handler.cc:6770 #4 0x0000558927285fdb in lock_external (thd=0x55892a79ae68, tables=0x55892a7ae818, count=1) at ../sql/lock.cc:393 #5 0x0000558927285aee in mysql_lock_tables (thd=0x55892a79ae68, sql_lock=0x55892a7ae7f8, flags=0) at ../sql/lock.cc:338 #6 0x0000558927284b1d in mysql_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ae7f0, count=1, flags=0) at ../sql/lock.cc:301 #7 0x0000558926be957c in lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, count=1, flags=0) at ../sql/sql_base.cc:5538 #8 0x0000558926beacb4 in open_and_lock_tables (thd=0x55892a79ae68, options=..., tables=0x55892a7ad088, derived=true, flags=0, prelocking_strategy=0x7f00cc059ae0) at ../sql/sql_base.cc:5250 #9 0x0000558926b8cc70 in open_and_lock_tables (thd=0x55892a79ae68, tables=0x55892a7ad088, derived=true, flags=0) at ../sql/sql_base.h:509 #10 0x0000558926c541b8 in mysql_insert (thd=0x55892a79ae68, table_list=0x55892a7ad088, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at ../sql/sql_insert.cc:756 #11 0x0000558926cc0179 in mysql_execute_command (thd=0x55892a79ae68) at ../sql/sql_parse.cc:4556 #12 0x0000558926cb3821 in mysql_parse (thd=0x55892a79ae68, rawbuf=0x55892a7acfa0 "INSERT INTO t VALUES (1),(0),(1)", length=32, parser_state=0x7f00cc05c2d8) at ../sql/sql_parse.cc:8016 #13 0x0000558926cb00b2 in dispatch_command (command=COM_QUERY, thd=0x55892a79ae68, packet=0x55892a7a3ad9 "INSERT INTO t VALUES (1),(0),(1)", packet_length=32, blocking=true) at ../sql/sql_parse.cc:1897 #14 0x0000558926cb4ad5 in do_command (thd=0x55892a79ae68, blocking=true) at ../sql/sql_parse.cc:1406 #15 0x0000558926ebcf24 in do_handle_one_connection (connect=0x55892a75b5f8, put_in_cache=true) at ../sql/sql_connect.cc:1410 #16 0x0000558926ebcc5a in handle_one_connection (arg=0x55892a749998) at ../sql/sql_connect.cc:1312 #17 0x00005589274f0349 in pfs_spawn_thread (arg=0x55892a6a3f98) at ../storage/perfschema/pfs.cc:2201 #18 0x00007f00d479a299 in start_thread () from /usr/lib/libpthread.so.0 #19 0x00007f00d44c3053 in clone () from /usr/lib/libc.so.6 (gdb) p trx->bulk_insert $9 = false (gdb) c Continuing.   Thread 2 received signal SIGABRT, Aborted. 0x00007f00d4400ef5 in raise () from /usr/lib/libc.so.6

            It seems that the code removal that I suggested earlier could do the trick. All mtr tests passed.

            marko Marko Mäkelä added a comment - It seems that the code removal that I suggested earlier could do the trick. All mtr tests passed.

            People

              marko Marko Mäkelä
              Roel Roel Van de Paar
              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.