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

Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::get_dup_key

    XMLWordPrintable

    Details

      Description

      Same assert as MDEV-25500 but different issue as per Marko Mäkelä

      SET sql_mode='';
      CREATE TABLE t1 (c INT PRIMARY KEY) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (0);
      CREATE TABLE t2 (a INT NOT NULL) ENGINE=CSV;
      CREATE TRIGGER tr AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t2 VALUES (1);
      INSERT INTO t2 VALUES (0); 
      CHECK TABLE t2;
      INSERT INTO t1 VALUES (0);
      INSERT INTO t2 VALUES (0),(0); 
      

      Leads to:

      10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

      mysqld: /test/10.6_dbg/sql/handler.cc:4439: uint handler::get_dup_key(int): Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed.
      

      10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

      Core was generated by `/test/MD100521-mariadb-10.6.1-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 0x153ce474d700 (LWP 611758))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000153cefbb2859 in __GI_abort () at abort.c:79
      #2  0x0000153cefbb2729 in __assert_fail_base (fmt=0x153cefd48588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555e618206d8 "table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2", file=0x555e6181e80b "/test/10.6_dbg/sql/handler.cc", line=4439, function=<optimized out>) at assert.c:92
      #3  0x0000153cefbc3f36 in __GI___assert_fail (assertion=assertion@entry=0x555e618206d8 "table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2", file=file@entry=0x555e6181e80b "/test/10.6_dbg/sql/handler.cc", line=line@entry=4439, function=function@entry=0x555e61820c68 "uint handler::get_dup_key(int)") at assert.c:101
      #4  0x0000555e60cc6404 in handler::get_dup_key (this=this@entry=0x153c8007cec0, error=error@entry=121) at /test/10.6_dbg/sql/handler.cc:4439
      #5  0x0000555e60cc6626 in handler::print_error (this=0x153c8007cec0, error=121, errflag=0) at /test/10.6_dbg/sql/handler.cc:4014
      #6  0x0000555e60b03a58 in open_table_from_share (thd=thd@entry=0x153c80000db8, share=share@entry=0x153c800a1050, alias=alias@entry=0x153c80014108, db_stat=db_stat@entry=33, prgflag=prgflag@entry=8, ha_open_flags=18, outparam=0x153c800a3408, is_create_table=false, partitions_to_open=0x0) at /test/10.6_dbg/sql/table.cc:4312
      #7  0x0000555e6095c5f7 in open_table (thd=thd@entry=0x153c80000db8, table_list=table_list@entry=0x153c800140c0, ot_ctx=ot_ctx@entry=0x153ce474bb00) at /test/10.6_dbg/sql/sql_base.cc:2001
      #8  0x0000555e60960eb8 in open_and_process_table (ot_ctx=0x153ce474bb00, has_prelocking_list=false, prelocking_strategy=0x153ce474bce0, flags=0, counter=0x153ce474bb9c, tables=0x153c800140c0, thd=0x153c80000db8) at /test/10.6_dbg/sql/sql_base.cc:3809
      #9  open_tables (thd=thd@entry=0x153c80000db8, options=@0x153c80006620: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x153ce474bb88, counter=counter@entry=0x153ce474bb9c, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x153ce474bce0) at /test/10.6_dbg/sql/sql_base.cc:4292
      #10 0x0000555e60961f32 in open_and_lock_tables (thd=thd@entry=0x153c80000db8, options=@0x153c80006620: {m_options = DDL_options_st::OPT_NONE}, tables=<optimized out>, tables@entry=0x153c800140c0, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x153ce474bce0) at /test/10.6_dbg/sql/sql_base.cc:5254
      #11 0x0000555e609aab97 in open_and_lock_tables (flags=0, derived=true, tables=0x153c800140c0, thd=0x153c80000db8) at /test/10.6_dbg/sql/sql_base.h:509
      #12 mysql_insert (thd=thd@entry=0x153c80000db8, table_list=0x153c800140c0, fields=@0x153c80006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555e61fd3480 <end_of_list>, last = 0x153c80006008, elements = 0}, <No data fields>}, values_list=@0x153c80006050: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153c80014d00, last = 0x153c80014dd8, elements = 2}, <No data fields>}, update_fields=@0x153c80006038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555e61fd3480 <end_of_list>, last = 0x153c80006038, elements = 0}, <No data fields>}, update_values=@0x153c80006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555e61fd3480 <end_of_list>, last = 0x153c80006020, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:756
      #13 0x0000555e609f3824 in mysql_execute_command (thd=thd@entry=0x153c80000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
      #14 0x0000555e609de02b in mysql_parse (thd=thd@entry=0x153c80000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153ce474c410) at /test/10.6_dbg/sql/sql_parse.cc:8018
      #15 0x0000555e609ece5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153c80000db8, packet=packet@entry=0x153c8000b799 "INSERT INTO t2 VALUES (0),(0)", packet_length=packet_length@entry=29, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
      #16 0x0000555e609f0250 in do_command (thd=0x153c80000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
      #17 0x0000555e60b4adec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x555e639986c8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #18 0x0000555e60b4b3f1 in handle_one_connection (arg=arg@entry=0x555e639986c8) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #19 0x0000555e60ffdcee in pfs_spawn_thread (arg=0x555e6388a418) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #20 0x0000153cf00c0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #21 0x0000153cefcaf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.38 (dbg), 10.3.29 (dbg), 10.4.19 (dbg), 10.5.10 (dbg), 10.6.1 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration