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

Error 153: No savepoint with that name upon ROLLBACK TO SAVEPOINT, assertion failure

    XMLWordPrintable

Details

    • Unexpected results
    • Hide
      On an error in CREATE TEMPORARY TABLE ... SELECT, InnoDB had internally aborted a transaction, while the server thought the transaction still existed. This caused various inconsistencies in binlog, disappeared savepoints, etc. This was fixed differently in different versions. In 10.11.16, 11.4.10, 11.8.6 the transaction is consistently and completely rolled back if CREATE TEMPORARY TABLE ... SELECT fails with an error. In 12.3.1 there is no rollback at all.
      Show
      On an error in CREATE TEMPORARY TABLE ... SELECT, InnoDB had internally aborted a transaction, while the server thought the transaction still existed. This caused various inconsistencies in binlog, disappeared savepoints, etc. This was fixed differently in different versions. In 10.11.16, 11.4.10, 11.8.6 the transaction is consistently and completely rolled back if CREATE TEMPORARY TABLE ... SELECT fails with an error. In 12.3.1 there is no rollback at all.
    • Q1/2026 Server Maintenance

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (a INT) ENGINE=InnoDB;
      START TRANSACTION;
      SELECT * FROM t;
      SAVEPOINT A;
      --error ER_WARN_DATA_OUT_OF_RANGE
      CREATE TEMPORARY TABLE tmp (a TINYINT) ENGINE=InnoDB AS SELECT 256 AS a;
      ROLLBACK TO SAVEPOINT A;
       
      DROP TABLE t;
      

      The above ends with an error on a non-debug build

      10.11 84dd2437c507ed194da03fe04fea14e261e47bc5 non-debug

      mysqltest: At line 12: query 'ROLLBACK TO SAVEPOINT A' failed: ER_ERROR_DURING_ROLLBACK (1181): Got error 153 "No savepoint with that name" during ROLLBACK
      

      or an assertion failure on a debug build:

      10.11 84dd2437c507ed194da03fe04fea14e261e47bc5 debug

      mariadbd: /data/bld/10.11-asan-ubsan/storage/innobase/handler/ha_innodb.cc:4835: int innobase_rollback_to_savepoint(handlerton*, THD*, void*): Assertion `"invalid state" == 0' failed.
      250521 12:48:20 [ERROR] /share8t/bld/10.11-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007fb61dc53eb2 in __GI___assert_fail (assertion=0x55f92522a220 "\"invalid state\" == 0", file=0x55f925217b60 "/data/bld/10.11-asan-ubsan/storage/innobase/handler/ha_innodb.cc", line=4835, function=0x55f925232cc0 "int innobase_rollback_to_savepoint(handlerton*, THD*, void*)") at ./assert/assert.c:101
      #11 0x000055f92390f1d6 in innobase_rollback_to_savepoint (thd=thd@entry=0x62c0001e0218, savepoint=savepoint@entry=0x6250000af170) at /data/bld/10.11-asan-ubsan/storage/innobase/handler/ha_innodb.cc:4835
      #12 0x000055f92260ea2b in ha_rollback_to_savepoint (thd=thd@entry=0x62c0001e0218, sv=sv@entry=0x6250000af138) at /data/bld/10.11-asan-ubsan/sql/handler.cc:2969
      #13 0x000055f921c2a22e in trans_rollback_to_savepoint (thd=thd@entry=0x62c0001e0218, name=...) at /data/bld/10.11-asan-ubsan/sql/transaction.cc:707
      #14 0x000055f921394fde in mysql_execute_command (thd=thd@entry=0x62c0001e0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:5870
      #15 0x000055f92139d4af in mysql_parse (thd=thd@entry=0x62c0001e0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fb60e5a2ab0) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:8179
      #16 0x000055f9213a6783 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0001e0218, packet=packet@entry=0x629000276219 "ROLLBACK TO SAVEPOINT A", packet_length=packet_length@entry=23, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1905
      #17 0x000055f9213b33bf in do_command (thd=thd@entry=0x62c0001e0218, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1418
      #18 0x000055f921ba6832 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x60800000d0b8, put_in_cache=put_in_cache@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1386
      #19 0x000055f921ba798f in handle_one_connection (arg=0x60800000d0b8) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1298
      #20 0x000055f92350382b in pfs_spawn_thread (arg=0x617000007e98) at /data/bld/10.11-asan-ubsan/storage/perfschema/pfs.cc:2201
      #21 0x00007fb61dca81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #22 0x00007fb61dd2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      On 10.11.11, ROLLBACK TO SAVEPOINT would succeed:

      10.11.11

      START TRANSACTION;
      SELECT * FROM t;
      a
      SAVEPOINT A;
      CREATE TEMPORARY TABLE tmp (a TINYINT) ENGINE=InnoDB AS SELECT 256 AS a;
      ERROR 22003: Out of range value for column 'a' at row 1
      ROLLBACK TO SAVEPOINT A;
      DROP TABLE t;
      

      The failure started happening after this commit in 10.11.12:

      commit f388222d495aa8b445da2653343dfb8233b218a8
      Author: Thirunarayanan Balathandayuthapani
      Date:   Thu Apr 17 10:28:17 2025 +0530
       
          MDEV-36504  Memory leak after CREATE TABLE..SELECT
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.