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

GTT: Assertion `thd->mdl_context.is_lock_owner...' failed in close_thread_table during CREATE OR REPLACE

    XMLWordPrintable

Details

    Description

      SET pseudo_slave_mode=1;
      CREATE GLOBAL TEMPORARY TABLE t1 (c INT) ON COMMIT PRESERVE ROWS;
      CREATE TEMPORARY TABLE t2 (d INT);
      LOCK TABLES t1 WRITE;
      CREATE OR REPLACE GLOBAL TEMPORARY TABLE t1 (c INT) SELECT * FROM t2;
      

      Leads to:

      MDEV-35915-v11 CS 12.2.0 033918c96079e4e39e9aabb0d94c077b8ec9470c (Debug, Clang 21.1.3-20250923) Build 14/01/2026

      mariadbd: /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:1038: void close_thread_table(THD *, TABLE **): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)' failed.
      

      MDEV-35915-v11 CS 12.2.0 033918c96079e4e39e9aabb0d94c077b8ec9470c (Debug, Clang 21.1.3-20250923) Build 14/01/2026

      Core was generated by `/test/MDEV-35915_v11_MD140126-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --no'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1021108)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x0000744bd4c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000744bd4c288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000744bd4c2881b in __assert_fail_base (fmt=0x744bd4dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x560ede165362 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str,"..., file=file@entry=0x560ede157be3 "/test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc", line=line@entry=1038, function=function@entry=0x560ede02e29f "void close_thread_table(THD *, TABLE **)") at ./assert/assert.c:94
      #6  0x0000744bd4c3b507 in __assert_fail (assertion=0x560ede165362 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str,"..., file=0x560ede157be3 "/test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc", line=1038, function=0x560ede02e29f "void close_thread_table(THD *, TABLE **)")at ./assert/assert.c:103
      #7  0x0000560edeb23547 in close_thread_table (thd=0x744aa4000d58, table_ptr=0x744aa4000ed0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:1031
      #8  0x0000560edeb23cb8 in close_thread_tables (thd=0x744aa4000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:1007
      #9  0x0000560edeb27db1 in Locked_tables_list::unlock_locked_tables (this=0x744aa4004f68, thd=0x744aa4000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:2744
      #10 0x0000560edeb27e3b in Locked_tables_list::unlock_locked_table (this=0x744aa4004f68, thd=0x744aa4000d58, mdl_ticket=0x744aa40197b0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:2787
      #11 0x0000560edec3102d in select_create::abort_result_set (this=0x744aa401bf70)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_insert.cc:5723
      #12 0x0000560edece4980 in handle_select (thd=0x744aa4000d58, lex=0x744aa4005078, result=0x744aa401bf70, setup_tables_done_option=0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_select.cc:652
      #13 0x0000560ededc1d4a in Sql_cmd_create_table_like::execute (this=0x744aa4019f68, thd=0x744aa4000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc:13972
      #14 0x0000560edec8ea9b in mysql_execute_command (thd=0x744aa4000d58, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:5879
      #15 0x0000560edec7fd08 in mysql_parse (thd=0x744aa4000d58, rawbuf=0x744aa4019e80 "CREATE OR REPLACE GLOBAL TEMPORARY TABLE t1 (c INT) SELECT * FROM t2", length=68, parser_state=0x744bd0b31a10)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:7912
      #16 0x0000560edec7d4e9 in dispatch_command (command=COM_QUERY, thd=0x744aa4000d58, packet=0x744aa400b1f9 "CREATE OR REPLACE GLOBAL TEMPORARY TABLE t1 (c INT) SELECT * FROM t2", packet_length=68, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1898
      #17 0x0000560edec8078a in do_command (thd=0x744aa4000d58, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1437
      #18 0x0000560edee7318e in do_handle_one_connection (connect=0x560ee19fd538, put_in_cache=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #19 0x0000560edee72f71 in handle_one_connection (arg=0x560ee1a6f5b8)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #20 0x0000744bd4c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x0000744bd4d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Testcase is CLI and MTR compatible.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Roel Van de Paar Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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