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

Assertion `old_part_id == m_last_part' failed in ha_partition::update_row on UPDATE

Details

    Description

      Possibly related to MDEV-22413 and MDEV-25364 but different versions than the latter and 10.2 does not produce any warnings (except on the alter). Also, this bug is InnoDB only. Not sporadic.

      SET sql_mode='';
      CREATE TABLE t (c INT) ENGINE=InnoDB PARTITION BY KEY(c) PARTITIONS 2;
      INSERT INTO t() VALUES();
      ALTER TABLE t MODIFY c INT NOT NULL;  # 1265 Data truncated for column 'c' at row 1
      UPDATE t SET c=-1 LIMIT 2;
      

      Leads to:

      10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Debug)

      mysqld: /test/10.8_dbg/sql/ha_partition.cc:4545: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `old_part_id == m_last_part' failed.
      

      10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Debug)

      Core was generated by `/test/MD121221-mariadb-10.8.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 0x153815817700 (LWP 2054107))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001538344a1859 in __GI_abort () at abort.c:79
      #2  0x00001538344a1729 in __assert_fail_base (fmt=0x153834637588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e17cfcceb9 "old_part_id == m_last_part", file=0x55e17cfc8460 "/test/10.8_dbg/sql/ha_partition.cc", line=4545, function=<optimized out>) at assert.c:92
      #3  0x00001538344b2f36 in __GI___assert_fail (assertion=assertion@entry=0x55e17cfcceb9 "old_part_id == m_last_part", file=file@entry=0x55e17cfc8460 "/test/10.8_dbg/sql/ha_partition.cc", line=line@entry=4545, function=function@entry=0x55e17cfcb7c8 "virtual int ha_partition::update_row(const uchar*, const uchar*)") at assert.c:101
      #4  0x000055e17c6e7423 in ha_partition::update_row (this=0x1537a802c280, old_data=0x1537a80aaea8 "\377", new_data=0x1537a80aaea0 "\377\377\377\377\377\245\245\245\377") at /test/10.8_dbg/sql/ha_partition.cc:4545
      #5  0x000055e17c408db3 in handler::ha_update_row (this=0x1537a802c280, old_data=0x1537a80aaea8 "\377", new_data=0x1537a80aaea0 "\377\377\377\377\377\245\245\245\377") at /test/10.8_dbg/sql/handler.cc:7569
      #6  0x000055e17c213304 in mysql_update (thd=thd@entry=0x1537a8000db8, table_list=<optimized out>, fields=@0x1537a8005c58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1537a8014740, last = 0x1537a8014740, elements = 1}, <No data fields>}, values=@0x1537a8006090: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1537a8014750, last = 0x1537a8014750, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=2, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /test/10.8_dbg/sql/sql_update.cc:1087
      #7  0x000055e17c0f8e7c in mysql_execute_command (thd=thd@entry=0x1537a8000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.8_dbg/sql/sql_limit.h:83
      #8  0x000055e17c0e3e0f in mysql_parse (thd=thd@entry=0x1537a8000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153815816400) at /test/10.8_dbg/sql/sql_parse.cc:8028
      #9  0x000055e17c0f2aab in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1537a8000db8, packet=packet@entry=0x1537a800b879 "UPDATE t SET c=-1 LIMIT 2", packet_length=packet_length@entry=25, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_class.h:1360
      #10 0x000055e17c0f5eea in do_command (thd=0x1537a8000db8, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_parse.cc:1402
      #11 0x000055e17c26f89c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55e17e7d6a18, put_in_cache=put_in_cache@entry=true) at /test/10.8_dbg/sql/sql_connect.cc:1418
      #12 0x000055e17c26fea1 in handle_one_connection (arg=arg@entry=0x55e17e7d6a18) at /test/10.8_dbg/sql/sql_connect.cc:1312
      #13 0x000055e17c6f1442 in pfs_spawn_thread (arg=0x55e17e6e89b8) at /test/10.8_dbg/storage/perfschema/pfs.cc:2201
      #14 0x00001538349b0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #15 0x000015383459e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.3.33 (dbg), 10.4.23 (dbg), 10.5.14 (dbg), 10.6.6 (dbg), 10.7.2 (dbg), 10.8.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.42 (dbg), 10.2.42 (opt), 10.3.33 (opt), 10.4.23 (opt), 10.5.14 (opt), 10.6.6 (opt), 10.7.2 (opt), 10.8.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)

      Attachments

        Issue Links

          Activity

            Roel, did you test this with other storage engines? I do not think that this should be specific to InnoDB.

            marko Marko Mäkelä added a comment - Roel , did you test this with other storage engines? I do not think that this should be specific to InnoDB.

            Yes. As per the description: this bug is InnoDB only.

            Roel Roel Van de Paar added a comment - Yes. As per the description: this bug is InnoDB only .

            Additional testcase with somewhat different stack

            SET sql_mode='';
            CREATE TABLE t (c INT,c2 INT) ENGINE=InnoDB PARTITION BY KEY(c) PARTITIONS 8;
            INSERT INTO t (c) SELECT MAX(c) FROM t;
            ALTER TABLE t CHANGE COLUMN c d INT NOT NULL;
            ALTER TABLE t ADD COLUMN c TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
            UPDATE t SET c=(SELECT 1 FROM t)-1;
            

            Leads to:

            11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

            mariadbd: /test/11.0_dbg/sql/ha_partition.cc:4646: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `old_part_id == m_last_part' failed.
            

            11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

            Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23220341073472)
                at ./nptl/pthread_kill.c:44
            [Current thread is 1 (Thread 0x151e682e6640 (LWP 2293934))]
            (gdb) bt
            #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23220341073472) at ./nptl/pthread_kill.c:44
            #1  __pthread_kill_internal (signo=6, threadid=23220341073472) at ./nptl/pthread_kill.c:78
            #2  __GI___pthread_kill (threadid=23220341073472, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
            #3  0x0000151e8f77f476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
            #4  0x0000151e8f7657f3 in __GI_abort () at ./stdlib/abort.c:79
            #5  0x0000151e8f76571b in __assert_fail_base (fmt=0x151e8f91a150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564ca09d8901 "old_part_id == m_last_part", file=0x564ca09d8988 "/test/11.0_dbg/sql/ha_partition.cc", line=4646, function=<optimized out>) at ./assert/assert.c:92
            #6  0x0000151e8f776e96 in __GI___assert_fail (assertion=0x564ca09d8901 "old_part_id == m_last_part", file=0x564ca09d8988 "/test/11.0_dbg/sql/ha_partition.cc", line=4646, function=0x564ca09da4c0 "virtual int ha_partition::update_row(const uchar*, const uchar*)") at ./assert/assert.c:101
            #7  0x0000564ca0233b09 in ha_partition::update_row (this=0x151dd40b08d0, old_data=0x151dd4025280 <incomplete sequence \373>, new_data=0x151dd4025270 <incomplete sequence \373>) at /test/11.0_dbg/sql/ha_partition.cc:4646
            #8  0x0000564c9ffb3685 in handler::ha_update_row (this=0x151dd40b08d0, old_data=0x151dd4025280 <incomplete sequence \373>, new_data=0x151dd4025270 <incomplete sequence \373>) at /test/11.0_dbg/sql/handler.cc:7838
            #9  0x0000564c9fddb455 in multi_update::do_updates (this=this@entry=0x151dd4015548) at /test/11.0_dbg/sql/sql_update.cc:2937
            #10 0x0000564c9fddc04b in multi_update::send_eof (this=0x151dd4015548) at /test/11.0_dbg/sql/sql_update.cc:3048
            #11 0x0000564c9fd667e0 in do_select (procedure=<optimized out>, join=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:22384
            #12 JOIN::exec_inner (this=this@entry=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:4888
            #13 0x0000564c9fd66be0 in JOIN::exec (this=this@entry=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:4666
            #14 0x0000564c9fd64b18 in mysql_select (thd=thd@entry=0x151dd4000d58, tables=tables@entry=0x151dd4013230, fields=@0x151e682e4d00: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x564ca11b5440 <end_of_list>, last = 0x151e682e4d00, elements = 0}, <No data fields>}, conds=conds@entry=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=37383395344512, result=0x151dd4015548, unit=0x151dd4004fa0, select_lex=0x151dd40057d0) at /test/11.0_dbg/sql/sql_select.cc:5146
            #15 0x0000564c9fddaa4d in mysql_multi_update (thd=thd@entry=0x151dd4000d58, table_list=0x151dd4013230, fields=fields@entry=0x151dd4005a88, values=values@entry=0x151dd4005ed8, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x151dd4004fa0, select_lex=0x151dd40057d0, result=0x151e682e4f00) at /test/11.0_dbg/sql/sql_update.cc:1982
            #16 0x0000564c9fcd7afd in mysql_execute_command (thd=thd@entry=0x151dd4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:4493
            #17 0x0000564c9fcdd7cf in mysql_parse (thd=thd@entry=0x151dd4000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151e682e52c0) at /test/11.0_dbg/sql/sql_parse.cc:8002
            #18 0x0000564c9fcdf963 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151dd4000d58, packet=packet@entry=0x151dd400ae19 "UPDATE t SET c=(SELECT 1 FROM t)-1", packet_length=packet_length@entry=34, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242
            #19 0x0000564c9fce17bc in do_command (thd=0x151dd4000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407
            #20 0x0000564c9fe326e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x564ca2f193f8, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416
            #21 0x0000564c9fe32941 in handle_one_connection (arg=0x564ca2f193f8) at /test/11.0_dbg/sql/sql_connect.cc:1318
            #22 0x0000151e8f7d1b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
            #23 0x0000151e8f863a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
            

            Bug confirmed present in:
            MariaDB: 10.3.38 (dbg), 10.4.29 (dbg), 10.5.20 (dbg), 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.2 (dbg), 11.0.1 (dbg)

            Bug (or feature/syntax) confirmed not present in:
            MariaDB: 10.3.38 (opt), 10.4.29 (opt), 10.5.20 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.2 (opt), 11.0.1 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)

            Roel Roel Van de Paar added a comment - Additional testcase with somewhat different stack SET sql_mode= '' ; CREATE TABLE t (c INT ,c2 INT ) ENGINE=InnoDB PARTITION BY KEY (c) PARTITIONS 8; INSERT INTO t (c) SELECT MAX (c) FROM t; ALTER TABLE t CHANGE COLUMN c d INT NOT NULL ; ALTER TABLE t ADD COLUMN c TIMESTAMP DEFAULT CURRENT_TIMESTAMP ; UPDATE t SET c=( SELECT 1 FROM t)-1; Leads to: 11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug) mariadbd: /test/11.0_dbg/sql/ha_partition.cc:4646: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `old_part_id == m_last_part' failed. 11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug) Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=23220341073472) at ./nptl/pthread_kill.c:44 [Current thread is 1 (Thread 0x151e682e6640 (LWP 2293934))] (gdb) bt #0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=23220341073472) at ./nptl/pthread_kill.c:44 #1 __pthread_kill_internal (signo=6, threadid=23220341073472) at ./nptl/pthread_kill.c:78 #2 __GI___pthread_kill (threadid=23220341073472, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #3 0x0000151e8f77f476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4 0x0000151e8f7657f3 in __GI_abort () at ./stdlib/abort.c:79 #5 0x0000151e8f76571b in __assert_fail_base (fmt=0x151e8f91a150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564ca09d8901 "old_part_id == m_last_part", file=0x564ca09d8988 "/test/11.0_dbg/sql/ha_partition.cc", line=4646, function=<optimized out>) at ./assert/assert.c:92 #6 0x0000151e8f776e96 in __GI___assert_fail (assertion=0x564ca09d8901 "old_part_id == m_last_part", file=0x564ca09d8988 "/test/11.0_dbg/sql/ha_partition.cc", line=4646, function=0x564ca09da4c0 "virtual int ha_partition::update_row(const uchar*, const uchar*)") at ./assert/assert.c:101 #7 0x0000564ca0233b09 in ha_partition::update_row (this=0x151dd40b08d0, old_data=0x151dd4025280 <incomplete sequence \373>, new_data=0x151dd4025270 <incomplete sequence \373>) at /test/11.0_dbg/sql/ha_partition.cc:4646 #8 0x0000564c9ffb3685 in handler::ha_update_row (this=0x151dd40b08d0, old_data=0x151dd4025280 <incomplete sequence \373>, new_data=0x151dd4025270 <incomplete sequence \373>) at /test/11.0_dbg/sql/handler.cc:7838 #9 0x0000564c9fddb455 in multi_update::do_updates (this=this@entry=0x151dd4015548) at /test/11.0_dbg/sql/sql_update.cc:2937 #10 0x0000564c9fddc04b in multi_update::send_eof (this=0x151dd4015548) at /test/11.0_dbg/sql/sql_update.cc:3048 #11 0x0000564c9fd667e0 in do_select (procedure=<optimized out>, join=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:22384 #12 JOIN::exec_inner (this=this@entry=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:4888 #13 0x0000564c9fd66be0 in JOIN::exec (this=this@entry=0x151dd4015658) at /test/11.0_dbg/sql/sql_select.cc:4666 #14 0x0000564c9fd64b18 in mysql_select (thd=thd@entry=0x151dd4000d58, tables=tables@entry=0x151dd4013230, fields=@0x151e682e4d00: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x564ca11b5440 <end_of_list>, last = 0x151e682e4d00, elements = 0}, <No data fields>}, conds=conds@entry=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=37383395344512, result=0x151dd4015548, unit=0x151dd4004fa0, select_lex=0x151dd40057d0) at /test/11.0_dbg/sql/sql_select.cc:5146 #15 0x0000564c9fddaa4d in mysql_multi_update (thd=thd@entry=0x151dd4000d58, table_list=0x151dd4013230, fields=fields@entry=0x151dd4005a88, values=values@entry=0x151dd4005ed8, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x151dd4004fa0, select_lex=0x151dd40057d0, result=0x151e682e4f00) at /test/11.0_dbg/sql/sql_update.cc:1982 #16 0x0000564c9fcd7afd in mysql_execute_command (thd=thd@entry=0x151dd4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:4493 #17 0x0000564c9fcdd7cf in mysql_parse (thd=thd@entry=0x151dd4000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151e682e52c0) at /test/11.0_dbg/sql/sql_parse.cc:8002 #18 0x0000564c9fcdf963 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151dd4000d58, packet=packet@entry=0x151dd400ae19 "UPDATE t SET c=(SELECT 1 FROM t)-1", packet_length=packet_length@entry=34, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242 #19 0x0000564c9fce17bc in do_command (thd=0x151dd4000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407 #20 0x0000564c9fe326e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x564ca2f193f8, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416 #21 0x0000564c9fe32941 in handle_one_connection (arg=0x564ca2f193f8) at /test/11.0_dbg/sql/sql_connect.cc:1318 #22 0x0000151e8f7d1b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442 #23 0x0000151e8f863a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81 Bug confirmed present in: MariaDB: 10.3.38 (dbg), 10.4.29 (dbg), 10.5.20 (dbg), 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.2 (dbg), 11.0.1 (dbg) Bug (or feature/syntax) confirmed not present in: MariaDB: 10.3.38 (opt), 10.4.29 (opt), 10.5.20 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.2 (opt), 11.0.1 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)

            A testcase variation, matching the stack of the previous comment.

            CREATE TABLE t (c INT,c2 CHAR(1)) ENGINE=InnoDB PARTITION BY KEY(c) PARTITIONS 8;
            INSERT INTO t (c) SELECT MIN(c) FROM t;
            ALTER TABLE t CHANGE COLUMN c new INT NOT NULL;
            ALTER TABLE t ADD COLUMN c DATE DEFAULT '1-1-1' NOT NULL AFTER c2;
            UPDATE t SET c=c * (SELECT c FROM t WHERE c=1);
            

            Roel Roel Van de Paar added a comment - A testcase variation, matching the stack of the previous comment. CREATE TABLE t (c INT ,c2 CHAR (1)) ENGINE=InnoDB PARTITION BY KEY (c) PARTITIONS 8; INSERT INTO t (c) SELECT MIN (c) FROM t; ALTER TABLE t CHANGE COLUMN c new INT NOT NULL ; ALTER TABLE t ADD COLUMN c DATE DEFAULT '1-1-1' NOT NULL AFTER c2; UPDATE t SET c=c * ( SELECT c FROM t WHERE c=1);

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.