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

Assertion `!global_table.versioned()' failed after ALTER TABLE GTT ADD SYSTEM VERSIONING

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      GTT does not allow versioning:

      MDEV-35915-2 CS 12.0.1 5d52514d536e9d141963f956408ac0efb4958a74 (Optimized, Clang 21.1.0-20250811) Build 06/09/2025

      12.0.1-opt>CREATE GLOBAL TEMPORARY TABLE t (c INT) WITH SYSTEM VERSIONING;
      ERROR 4226 (HY000): Clause SYSTEM VERSIONING can't be used with GLOBAL TEMPORARY TABLE
      

      However, when using:

      CREATE GLOBAL TEMPORARY TABLE t (c INT);
      TRUNCATE t;
      ALTER TABLE t ADD SYSTEM VERSIONING;
      SELECT * FROM t;  # Asserts debug builds
      SHOW CREATE TABLE t\G
      

      We see:

      MDEV-35915-2 CS 12.0.1 5d52514d536e9d141963f956408ac0efb4958a74 (Optimized, Clang 21.1.0-20250811) Build 06/09/2025

      12.0.1-opt>CREATE GLOBAL TEMPORARY TABLE t (c INT);
      Query OK, 0 rows affected (0.006 sec)
       
      12.0.1-opt>TRUNCATE t;
      Query OK, 0 rows affected (0.000 sec)
       
      12.0.1-opt>ALTER TABLE t ADD SYSTEM VERSIONING;
      Query OK, 0 rows affected (0.006 sec)              
      Records: 0  Duplicates: 0  Warnings: 0
       
      12.0.1-opt>SELECT * FROM t;
      Empty set (0.000 sec)
       
      12.0.1-opt>SHOW CREATE TABLE t\G
      *************************** 1. row ***************************
             Table: t
      Create Table: CREATE GLOBAL TEMPORARY TABLE `t` (
        `c` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ON COMMIT DELETE ROWS WITH SYSTEM VERSIONING
      1 row in set (0.000 sec)
      

      And on debug, the SELECT will assert:

      MDEV-35915-2 CS 12.0.1 f88831afe2e18d124dfeaaf15ac51725a319b8e2 (Debug, Clang 21.1.0-20250811) Build 06/09/2025

      mariadbd: /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_table.cc:6211: my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *): Assertion `!global_table.versioned()' failed.
      

      MDEV-35915-2 CS 12.0.1 f88831afe2e18d124dfeaaf15ac51725a319b8e2 (Debug, Clang 21.1.0-20250811) Build 06/09/2025

      Core was generated by `/test/MDEV-35915_2_MD060925-mariadb-12.0.1-linux-x86_64-dbg/bin/mariadbd --no-d'.
      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 922333)]
      (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  0x00007a1649e4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007a1649e288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007a1649e2881b in __assert_fail_base (fmt=0x7a1649fd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x64a2c1c20edd "!global_table.versioned()", file=file@entry=0x64a2c1c59c13 "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_table.cc", line=line@entry=6211, function=function@entry=0x64a2c1b437e7 "my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *)") at ./assert/assert.c:94
      #6  0x00007a1649e3b507 in __assert_fail (assertion=0x64a2c1c20edd "!global_table.versioned()", file=0x64a2c1c59c13 "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_table.cc", line=6211, function=0x64a2c1b437e7 "my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *)") at ./assert/assert.c:103
      #7  0x000064a2c287ecc2 in open_global_temporary_table (thd=0x7a151c000d58, source=0x7a151c03a420, out_table=0x7a151c01a5b0, mdl_ticket=0x7a151c016000)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_table.cc:6211
      #8  0x000064a2c2601f59 in open_table (thd=0x7a151c000d58, table_list=0x7a151c01a5b0, ot_ctx=0x7a164832fb88)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:2350
      #9  0x000064a2c2606fd1 in open_and_process_table (thd=0x7a151c000d58, tables=0x7a151c01a5b0, counter=0x7a164832fc3c, flags=0, prelocking_strategy=0x7a164832fca0, has_prelocking_list=false, ot_ctx=0x7a164832fb88)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:4307
      #10 0x000064a2c2605e1f in open_tables (thd=0x7a151c000d58, options=@0x7a151c00672c: {m_options = DDL_options_st::OPT_NONE}, start=0x7a164832fc50, counter=0x7a164832fc3c, flags=0, prelocking_strategy=0x7a164832fca0)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:4793
      #11 0x000064a2c2608bba in open_and_lock_tables (thd=0x7a151c000d58, options=@0x7a151c00672c: {m_options = DDL_options_st::OPT_NONE}, tables=0x7a151c01a5b0, derived=true, flags=0, prelocking_strategy=0x7a164832fca0)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:5781
      #12 0x000064a2c249943e in open_and_lock_tables (thd=0x7a151c000d58, tables=0x7a151c01a5b0, derived=true, flags=0)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.h:544
      #13 0x000064a2c276439a in execute_sqlcom_select (thd=0x7a151c000d58, all_tables=0x7a151c01a5b0)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:6091
      #14 0x000064a2c275af65 in mysql_execute_command (thd=0x7a151c000d58, is_called_from_prepared_stmt=false)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:3958
      #15 0x000064a2c2753ea8 in mysql_parse (thd=0x7a151c000d58, rawbuf=0x7a151c019ef0 "SELECT * FROM t", length=15, parser_state=0x7a1648331a10)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:7893
      #16 0x000064a2c2751689 in dispatch_command (command=COM_QUERY, thd=0x7a151c000d58, packet=0x7a151c00b269 "SELECT * FROM t", packet_length=15, blocking=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1881
      #17 0x000064a2c275492a in do_command (thd=0x7a151c000d58, blocking=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1420
      #18 0x000064a2c2945c1e in do_handle_one_connection (connect=0x64a2c55deea8, put_in_cache=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #19 0x000064a2c2945a01 in handle_one_connection (arg=0x64a2c5507638)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #20 0x00007a1649e9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x00007a1649f29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MyISAM and InnoDB both affected.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              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.