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

Assertion `!error' failed in ha_partition::delete_row on DELETE

Details

    Description

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY '';
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD '');
      CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
      INSERT INTO t VALUES (0,1,0),(1,0,0),(2,0,0);
      CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
      ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
      DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3;
      

      Leads to:

      10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

      mysqld: /test/10.11_dbg/sql/ha_partition.cc:4782: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed.
      

      10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

      Core was generated by `/test/MD171122-mariadb-10.11.2-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 0x14d2316c0700 (LWP 2750433))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014d24a822859 in __GI_abort () at abort.c:79
      #2  0x000014d24a822729 in __assert_fail_base (fmt=0x14d24a9b8588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555d6fc34ee7 "!error", file=0x555d6fc9b9d8 "/test/10.11_dbg/sql/ha_partition.cc", line=4782, function=<optimized out>) at assert.c:92
      #3  0x000014d24a833fd6 in __GI___assert_fail (assertion=assertion@entry=0x555d6fc34ee7 "!error", file=file@entry=0x555d6fc9b9d8 "/test/10.11_dbg/sql/ha_partition.cc", line=line@entry=4782, function=function@entry=0x555d6fc9c2c8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101
      #4  0x0000555d6f45e9e3 in ha_partition::delete_row (this=0x14d1ec0e70e0, buf=0x14d1ec0d9d78 "\377") at /test/10.11_dbg/sql/ha_partition.cc:4782
      #5  0x0000555d6f1d3785 in handler::ha_delete_row (this=0x14d1ec0e70e0, buf=0x14d1ec0d9d78 "\377") at /test/10.11_dbg/sql/handler.cc:7700
      #6  0x0000555d6ee96021 in TABLE::delete_row (this=0x14d1ec0cf708) at /test/10.11_dbg/sql/sql_delete.cc:281
      #7  multi_delete::do_table_deletes (this=this@entry=0x14d1ec016128, table=table@entry=0x14d1ec0cf708, sort_info=<optimized out>, ignore=false) at /test/10.11_dbg/sql/sql_delete.cc:1557
      #8  0x0000555d6ee96305 in multi_delete::do_deletes (this=this@entry=0x14d1ec016128) at /test/10.11_dbg/sql/sql_delete.cc:1503
      #9  0x0000555d6ee9638c in multi_delete::send_eof (this=0x14d1ec016128) at /test/10.11_dbg/sql/sql_delete.cc:1611
      #10 0x0000555d6ef72c6d in do_select (procedure=<optimized out>, join=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:21414
      #11 JOIN::exec_inner (this=this@entry=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:4823
      #12 0x0000555d6ef72fd4 in JOIN::exec (this=this@entry=0x14d1ec016198) at /test/10.11_dbg/sql/sql_select.cc:4601
      #13 0x0000555d6ef70f88 in mysql_select (thd=thd@entry=0x14d1ec000d48, tables=0x14d1ec0140f0, fields=@0x14d1ec005a58: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d1ec015f40, last = 0x14d1ec015f40, elements = 1}, <No data fields>}, conds=conds@entry=0x0, og_num=og_num@entry=0, order=order@entry=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=37385559870336, result=0x14d1ec016128, unit=0x14d1ec004f88, select_lex=0x14d1ec0057b8) at /test/10.11_dbg/sql/sql_select.cc:5081
      #14 0x0000555d6eeedb55 in mysql_execute_command (thd=thd@entry=0x14d1ec000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:4864
      #15 0x0000555d6eed9606 in mysql_parse (thd=thd@entry=0x14d1ec000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d2316bf300) at /test/10.11_dbg/sql/sql_parse.cc:7998
      #16 0x0000555d6eee6b41 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d1ec000d48, packet=packet@entry=0x14d1ec00adf9 "DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3", packet_length=packet_length@entry=55, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
      #17 0x0000555d6eee8f7f in do_command (thd=0x14d1ec000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
      #18 0x0000555d6f043763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x555d7296a678, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
      #19 0x0000555d6f043c32 in handle_one_connection (arg=0x555d7296a678) at /test/10.11_dbg/sql/sql_connect.cc:1318
      #20 0x000014d24ad33609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #21 0x000014d24a91f133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.27 (dbg), 10.5.18 (dbg), 10.6.10 (dbg), 10.7.6 (dbg), 10.8.5 (dbg), 10.9.3 (dbg), 10.10.2 (dbg), 10.11.2 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.4.27 (opt), 10.5.18 (opt), 10.6.10 (opt), 10.7.6 (opt), 10.8.5 (opt), 10.9.3 (opt), 10.10.2 (opt), 10.11.2 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar created issue -
            Roel Roel Van de Paar added a comment - - edited

            Secondary testcase, leading to similar but not indentical stack

            INSTALL PLUGIN Spider SONAME 'ha_spider.so';
            CREATE USER Spider@localhost IDENTIFIED BY '';
            CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD '');
            CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
            CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
            INSERT INTO t VALUES (1,1,''),(11,'',''),(12,0,'');
            ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
            DELETE FROM t1 WHERE (SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0;
            

            Leads to:

            10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

            mysqld: /test/10.11_dbg/sql/ha_partition.cc:4782: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed.
            

            10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

            Core was generated by `/test/MD171122-mariadb-10.11.2-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 0x150cbc12d700 (LWP 91772))]
            (gdb) bt
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #1  0x0000150ce1eed859 in __GI_abort () at abort.c:79
            #2  0x0000150ce1eed729 in __assert_fail_base (fmt=0x150ce2083588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556aefd11ee7 "!error", file=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=4782, function=<optimized out>) at assert.c:92
            #3  0x0000150ce1efefd6 in __GI___assert_fail (assertion=assertion@entry=0x556aefd11ee7 "!error", file=file@entry=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=line@entry=4782, function=function@entry=0x556aefd792c8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101
            #4  0x0000556aef53b9e3 in ha_partition::delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/ha_partition.cc:4782
            #5  0x0000556aef2b0785 in handler::ha_delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/handler.cc:7700
            #6  0x0000556aeef738eb in TABLE::delete_row (this=0x150c3c091f08) at /test/10.11_dbg/sql/sql_delete.cc:281
            #7  0x0000556aeef71e30 in mysql_delete (thd=thd@entry=0x150c3c000d48, table_list=0x150c3c013240, conds=<optimized out>, order_list=order_list@entry=0x150c3c005aa0, limit=18446744073709551614, options=<optimized out>, result=<optimized out>) at /test/10.11_dbg/sql/sql_delete.cc:842
            #8  0x0000556aeefca719 in mysql_execute_command (thd=thd@entry=0x150c3c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_limit.h:85
            #9  0x0000556aeefb6606 in mysql_parse (thd=thd@entry=0x150c3c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150cbc12c300) at /test/10.11_dbg/sql/sql_parse.cc:7998
            #10 0x0000556aeefc3b41 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150c3c000d48, packet=packet@entry=0x150c3c00adf9 "DELETE FROM t1 WHERE (SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0", packet_length=packet_length@entry=60, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
            #11 0x0000556aeefc5f7f in do_command (thd=0x150c3c000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
            #12 0x0000556aef120763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x556af2b7aad8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
            #13 0x0000556aef120c32 in handle_one_connection (arg=0x556af2b7aad8) at /test/10.11_dbg/sql/sql_connect.cc:1318
            #14 0x0000150ce23fe609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #15 0x0000150ce1fea133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Roel Roel Van de Paar added a comment - - edited Secondary testcase, leading to similar but not indentical stack INSTALL PLUGIN Spider SONAME 'ha_spider.so' ; CREATE USER Spider@localhost IDENTIFIED BY '' ; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock' , DATABASE 'test' , user 'Spider' , PASSWORD '' ); CREATE TABLE t (c INT KEY ,c1 BLOB,c2 TEXT) ENGINE=InnoDB; CREATE TABLE t1 (c INT KEY ,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT= 'WRAPPER "mysql",srv "srv",TABLE "t"' ; INSERT INTO t VALUES (1,1, '' ),(11, '' , '' ),(12,0, '' ); ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2)); DELETE FROM t1 WHERE ( SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0; Leads to: 10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug) mysqld: /test/10.11_dbg/sql/ha_partition.cc:4782: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed. 10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug) Core was generated by `/test/MD171122-mariadb-10.11.2-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 0x150cbc12d700 (LWP 91772))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x0000150ce1eed859 in __GI_abort () at abort.c:79 #2 0x0000150ce1eed729 in __assert_fail_base (fmt=0x150ce2083588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556aefd11ee7 "!error", file=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=4782, function=<optimized out>) at assert.c:92 #3 0x0000150ce1efefd6 in __GI___assert_fail (assertion=assertion@entry=0x556aefd11ee7 "!error", file=file@entry=0x556aefd789d8 "/test/10.11_dbg/sql/ha_partition.cc", line=line@entry=4782, function=function@entry=0x556aefd792c8 "virtual int ha_partition::delete_row(const uchar*)") at assert.c:101 #4 0x0000556aef53b9e3 in ha_partition::delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/ha_partition.cc:4782 #5 0x0000556aef2b0785 in handler::ha_delete_row (this=0x150c3c0a9090, buf=0x150c3c097918 "\376\v") at /test/10.11_dbg/sql/handler.cc:7700 #6 0x0000556aeef738eb in TABLE::delete_row (this=0x150c3c091f08) at /test/10.11_dbg/sql/sql_delete.cc:281 #7 0x0000556aeef71e30 in mysql_delete (thd=thd@entry=0x150c3c000d48, table_list=0x150c3c013240, conds=<optimized out>, order_list=order_list@entry=0x150c3c005aa0, limit=18446744073709551614, options=<optimized out>, result=<optimized out>) at /test/10.11_dbg/sql/sql_delete.cc:842 #8 0x0000556aeefca719 in mysql_execute_command (thd=thd@entry=0x150c3c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_limit.h:85 #9 0x0000556aeefb6606 in mysql_parse (thd=thd@entry=0x150c3c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150cbc12c300) at /test/10.11_dbg/sql/sql_parse.cc:7998 #10 0x0000556aeefc3b41 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150c3c000d48, packet=packet@entry=0x150c3c00adf9 "DELETE FROM t1 WHERE (SELECT 1 FROM t1 b WHERE b.c1=t1.c1)>0", packet_length=packet_length@entry=60, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346 #11 0x0000556aeefc5f7f in do_command (thd=0x150c3c000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407 #12 0x0000556aef120763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x556af2b7aad8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416 #13 0x0000556aef120c32 in handle_one_connection (arg=0x556af2b7aad8) at /test/10.11_dbg/sql/sql_connect.cc:1318 #14 0x0000150ce23fe609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #15 0x0000150ce1fea133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            julien.fritsch Julien Fritsch made changes -
            Field Original Value New Value
            Fix Version/s 10.7 [ 24805 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.8 [ 26121 ]
            Roel Roel Van de Paar made changes -
            ycp Yuchen Pei made changes -
            Assignee Nayuta Yanagisawa [ JIRAUSER47117 ] Yuchen Pei [ JIRAUSER52627 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.4 [ 22408 ]
            Roel Roel Van de Paar made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]

            Additional testcase with slightly offset stack

            INSTALL PLUGIN Spider SONAME 'ha_spider.so';
            CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE'',USER'',PASSWORD'');
            CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
            CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"';
            INSERT INTO t VALUES (1,1,0),(11,0,0),(12,0,0);
            CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=InnoDB;
            ALTER TABLE t1 RENAME TO t5;
            LOAD DATA INFILE 'out1' INTO TABLE t2;
            ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
            DELETE FROM t1;
            

            Leads to:

            CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

            mariadbd: /test/11.2_dbg/sql/ha_partition.cc:4860: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed.
            

            CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)

            Core was generated by `/test/MD090924-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
            Program terminated with signal SIGABRT, Aborted.
            Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
            #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
             
            [Current thread is 1 (LWP 3174930)]
            (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  0x00001507b7c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
            #4  0x00001507b7c288ff in __GI_abort () at ./stdlib/abort.c:79
            #5  0x00001507b7c2881b in __assert_fail_base (fmt=0x1507b7dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561abd191d39 "!error", file=file@entry=0x561abd06f300 "/test/11.2_dbg/sql/ha_partition.cc", line=line@entry=4860, function=function@entry=0x561abd06fbc8 "virtual int ha_partition::delete_row(const uchar*)") at ./assert/assert.c:94
            #6  0x00001507b7c3b507 in __assert_fail (assertion=0x561abd191d39 "!error", file=0x561abd06f300 "/test/11.2_dbg/sql/ha_partition.cc", line=4860, function=0x561abd06fbc8 "virtual int ha_partition::delete_row(const uchar*)") at ./assert/assert.c:103
            #7  0x0000561abc86eff4 in ha_partition::delete_row (this=0x15075c30a6c0, buf=0x15075c05d818 "\377\v") at /test/11.2_dbg/sql/ha_partition.cc:4860
            #8  0x0000561abc5e7683 in handler::ha_delete_row (this=0x15075c30a6c0, buf=0x15075c05d818 "\377\v") at /test/11.2_dbg/sql/handler.cc:8080
            #9  0x0000561abc276c4b in TABLE::delete_row (this=this@entry=0x15075c313bf8)at /test/11.2_dbg/sql/sql_delete.cc:295
            #10 0x0000561abc27435f in Sql_cmd_delete::delete_from_single_table (this=this@entry=0x15075c014538, thd=thd@entry=0x15075c000d58)at /test/11.2_dbg/sql/sql_delete.cc:840
            #11 0x0000561abc275230 in Sql_cmd_delete::execute_inner (this=0x15075c014538, thd=0x15075c000d58) at /test/11.2_dbg/sql/sql_delete.cc:1821
            #12 0x0000561abc30c0df in Sql_cmd_dml::execute (this=0x15075c014538, thd=0x15075c000d58) at /test/11.2_dbg/sql/sql_select.cc:33800
            #13 0x0000561abc2c83ea in mysql_execute_command (thd=thd@entry=0x15075c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:4433
            #14 0x0000561abc2cdd26 in mysql_parse (thd=thd@entry=0x15075c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1507b55682a0)at /test/11.2_dbg/sql/sql_parse.cc:7929
            #15 0x0000561abc2d01bd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15075c000d58, packet=packet@entry=0x15075c00b309 "DELETE FROM t1", packet_length=packet_length@entry=14, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248
            #16 0x0000561abc2d23e3 in do_command (thd=0x15075c000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407
            #17 0x0000561abc43e35c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561abf543fa8, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439
            #18 0x0000561abc43e65c in handle_one_connection (arg=arg@entry=0x561abf543fa8)at /test/11.2_dbg/sql/sql_connect.cc:1341
            #19 0x0000561abc88562c in pfs_spawn_thread (arg=0x561abf5130f8)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201
            #20 0x00001507b7c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
            #21 0x00001507b7d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            

            Bug confirmed present in:
            MariaDB: 10.5.27 (dbg), 10.6.20 (dbg), 10.11.10 (dbg), 11.2.6 (dbg), 11.4.4 (dbg), 11.6.2 (dbg), 11.7.0 (dbg)

            Bug (or feature/syntax) confirmed not present in:
            MariaDB: 10.5.27 (opt), 10.6.20 (opt), 10.11.10 (opt), 11.2.6 (opt), 11.4.4 (opt), 11.6.2 (opt), 11.7.0 (opt)

            Roel Roel Van de Paar added a comment - Additional testcase with slightly offset stack INSTALL PLUGIN Spider SONAME 'ha_spider.so' ; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock' , DATABASE '' , USER '' , PASSWORD '' ); CREATE TABLE t (c INT KEY ,c1 BLOB,c2 TEXT) ENGINE=InnoDB; CREATE TABLE t1 (c INT KEY ,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT= 'WRAPPER "mysql",SRV "srv",TABLE "t"' ; INSERT INTO t VALUES (1,1,0),(11,0,0),(12,0,0); CREATE TEMPORARY TABLE t1 (c1 INT ) ENGINE=InnoDB; ALTER TABLE t1 RENAME TO t5; LOAD DATA INFILE 'out1' INTO TABLE t2; ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2)); DELETE FROM t1; Leads to: CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug) mariadbd: /test/11.2_dbg/sql/ha_partition.cc:4860: virtual int ha_partition::delete_row(const uchar*): Assertion `!error' failed. CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug) Core was generated by `/test/MD090924-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'. Program terminated with signal SIGABRT, Aborted. Download failed: Invalid argument. Continuing without source file ./nptl/./nptl/pthread_kill.c. #0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44   [Current thread is 1 (LWP 3174930)] (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 0x00001507b7c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26 #4 0x00001507b7c288ff in __GI_abort () at ./stdlib/abort.c:79 #5 0x00001507b7c2881b in __assert_fail_base (fmt=0x1507b7dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561abd191d39 "!error", file=file@entry=0x561abd06f300 "/test/11.2_dbg/sql/ha_partition.cc", line=line@entry=4860, function=function@entry=0x561abd06fbc8 "virtual int ha_partition::delete_row(const uchar*)") at ./assert/assert.c:94 #6 0x00001507b7c3b507 in __assert_fail (assertion=0x561abd191d39 "!error", file=0x561abd06f300 "/test/11.2_dbg/sql/ha_partition.cc", line=4860, function=0x561abd06fbc8 "virtual int ha_partition::delete_row(const uchar*)") at ./assert/assert.c:103 #7 0x0000561abc86eff4 in ha_partition::delete_row (this=0x15075c30a6c0, buf=0x15075c05d818 "\377\v") at /test/11.2_dbg/sql/ha_partition.cc:4860 #8 0x0000561abc5e7683 in handler::ha_delete_row (this=0x15075c30a6c0, buf=0x15075c05d818 "\377\v") at /test/11.2_dbg/sql/handler.cc:8080 #9 0x0000561abc276c4b in TABLE::delete_row (this=this@entry=0x15075c313bf8)at /test/11.2_dbg/sql/sql_delete.cc:295 #10 0x0000561abc27435f in Sql_cmd_delete::delete_from_single_table (this=this@entry=0x15075c014538, thd=thd@entry=0x15075c000d58)at /test/11.2_dbg/sql/sql_delete.cc:840 #11 0x0000561abc275230 in Sql_cmd_delete::execute_inner (this=0x15075c014538, thd=0x15075c000d58) at /test/11.2_dbg/sql/sql_delete.cc:1821 #12 0x0000561abc30c0df in Sql_cmd_dml::execute (this=0x15075c014538, thd=0x15075c000d58) at /test/11.2_dbg/sql/sql_select.cc:33800 #13 0x0000561abc2c83ea in mysql_execute_command (thd=thd@entry=0x15075c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:4433 #14 0x0000561abc2cdd26 in mysql_parse (thd=thd@entry=0x15075c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1507b55682a0)at /test/11.2_dbg/sql/sql_parse.cc:7929 #15 0x0000561abc2d01bd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15075c000d58, packet=packet@entry=0x15075c00b309 "DELETE FROM t1", packet_length=packet_length@entry=14, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248 #16 0x0000561abc2d23e3 in do_command (thd=0x15075c000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407 #17 0x0000561abc43e35c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561abf543fa8, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439 #18 0x0000561abc43e65c in handle_one_connection (arg=arg@entry=0x561abf543fa8)at /test/11.2_dbg/sql/sql_connect.cc:1341 #19 0x0000561abc88562c in pfs_spawn_thread (arg=0x561abf5130f8)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201 #20 0x00001507b7c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447 #21 0x00001507b7d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 Bug confirmed present in: MariaDB: 10.5.27 (dbg), 10.6.20 (dbg), 10.11.10 (dbg), 11.2.6 (dbg), 11.4.4 (dbg), 11.6.2 (dbg), 11.7.0 (dbg) Bug (or feature/syntax) confirmed not present in: MariaDB: 10.5.27 (opt), 10.6.20 (opt), 10.11.10 (opt), 11.2.6 (opt), 11.4.4 (opt), 11.6.2 (opt), 11.7.0 (opt)
            Roel Roel Van de Paar made changes -
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.4 [ 29301 ]
            Fix Version/s 11.6 [ 29515 ]
            Affects Version/s 11.2 [ 28603 ]
            Affects Version/s 11.4 [ 29301 ]
            Affects Version/s 11.6 [ 29515 ]
            Affects Version/s 11.7 [ 29815 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei added a comment -

            The symptom looks similar to that of MDEV-31030

            ycp Yuchen Pei added a comment - The symptom looks similar to that of MDEV-31030
            ycp Yuchen Pei added a comment -

            The testcase can be simplified as follows. The problem seems to be caused by altering a spider table to an "incomplete" partitioning that does not cover certain rows in the remote table.

            --disable_query_log
            --disable_result_log
            --source ../../t/test_init.inc
            --enable_result_log
            --enable_query_log
             
            set spider_same_server_link= 1;
            evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
            OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
             
            CREATE TABLE t (c INT);
            INSERT INTO t VALUES (13);
            # would not be a problem if we replace 42 with 13
            CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p VALUES IN (42));
             
            # If we do the following then we get
            # mysqltest: At line 14: query 'alter table t PARTITION BY LIST (c) (PARTITION p VALUES IN (42))' failed: 1526: Table has no partition for value 13
            # alter table t PARTITION BY LIST (c) (PARTITION p VALUES IN (42));
             
            # would not be a problem
            # DELETE FROM t1;
             
            DELETE FROM a1 USING t1 AS a1;
             
            drop table t, t1;
            drop server srv;
             
            --disable_query_log
            --disable_result_log
            --source ../../t/test_deinit.inc
            --enable_result_log
            --enable_query_log

            ycp Yuchen Pei added a comment - The testcase can be simplified as follows. The problem seems to be caused by altering a spider table to an "incomplete" partitioning that does not cover certain rows in the remote table. --disable_query_log --disable_result_log --source ../../t/test_init.inc --enable_result_log --enable_query_log   set spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK" , DATABASE 'test' , user 'root' );   CREATE TABLE t (c INT ); INSERT INTO t VALUES (13); # would not be a problem if we replace 42 with 13 CREATE TABLE t1 (c INT ) ENGINE=Spider COMMENT= 'WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p VALUES IN (42));   # If we do the following then we get # mysqltest: At line 14: query 'alter table t PARTITION BY LIST (c) (PARTITION p VALUES IN (42))' failed: 1526: Table has no partition for value 13 # alter table t PARTITION BY LIST (c) (PARTITION p VALUES IN (42));   # would not be a problem # DELETE FROM t1;   DELETE FROM a1 USING t1 AS a1;   drop table t, t1; drop server srv;   --disable_query_log --disable_result_log --source ../../t/test_deinit.inc --enable_result_log --enable_query_log
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            ycp Yuchen Pei added a comment -

            The error is legitimate, so the question is whether the assert is necessary. One possible solution to this issue is to try to detect the incomplete coverage of the partitions over the data node table rows earlier in the DELETE statement when opening the partition table, but I don't see how to justify the extra complexity introduced by this change as well as the fact that it is basically doing the same check as at the assertion failure, if we could simply remove the assert. Therefore my patch proposes the removal of the assertion.

            Hi serg, since you added the assertion I'm asking you to review this change, ptal thanks

            3116ab76fe9 upstream/bb-10.5-mdev-30067 bb-10.5-ycp MDEV-30067 Remove an overly enthusiastic assert when deleting from a partitioned table

            ycp Yuchen Pei added a comment - The error is legitimate, so the question is whether the assert is necessary. One possible solution to this issue is to try to detect the incomplete coverage of the partitions over the data node table rows earlier in the DELETE statement when opening the partition table, but I don't see how to justify the extra complexity introduced by this change as well as the fact that it is basically doing the same check as at the assertion failure, if we could simply remove the assert. Therefore my patch proposes the removal of the assertion. Hi serg , since you added the assertion I'm asking you to review this change, ptal thanks 3116ab76fe9 upstream/bb-10.5-mdev-30067 bb-10.5-ycp MDEV-30067 Remove an overly enthusiastic assert when deleting from a partitioned table

            then you need to remove the second assertion as well. With spider you can easily have a row belonging to a wrong partition, so there will be no error, but the partition number will be wrong.

            please, add a test case for that too.

            and if you remove both asserts, then what value does this #ifdef block has? you can remove get_part_for_buf() too. And part of the comment, which will be no longer relevant. Only a couple of lines of the comment and bitmap_is_set() can stay.

            serg Sergei Golubchik added a comment - then you need to remove the second assertion as well. With spider you can easily have a row belonging to a wrong partition, so there will be no error, but the partition number will be wrong. please, add a test case for that too. and if you remove both asserts, then what value does this #ifdef block has? you can remove get_part_for_buf() too. And part of the comment, which will be no longer relevant. Only a couple of lines of the comment and bitmap_is_set() can stay.
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ycp Yuchen Pei added a comment -

            Hi serg,

            Thanks for the comment, ptal at the updated commit:

            fa3656ab1ff upstream/bb-10.5-mdev-30067 MDEV-30067 Remove some overly enthusiastic asserts when deleting from a partitioned table
            

            Addressing your comments:

            > then you need to remove the second assertion as well. With spider you can easily have a row belonging to a wrong partition, so there will be no error, but the partition number will be wrong.

            > please, add a test case for that too.

            Done.

            > and if you remove both asserts, then what value does this #ifdef block has? you can remove get_part_for_buf() too. And part of the comment, which will be no longer relevant. Only a couple of lines of the comment and bitmap_is_set() can stay.

            Removed get_part_for_buf() and trimmed the comment accordingly. The remaining asserts are not tripped w.r.t. this issue so there's no reason to remove them here to my knowledge.

            ycp Yuchen Pei added a comment - Hi serg , Thanks for the comment, ptal at the updated commit: fa3656ab1ff upstream/bb-10.5-mdev-30067 MDEV-30067 Remove some overly enthusiastic asserts when deleting from a partitioned table Addressing your comments: > then you need to remove the second assertion as well. With spider you can easily have a row belonging to a wrong partition, so there will be no error, but the partition number will be wrong. > please, add a test case for that too. Done. > and if you remove both asserts, then what value does this #ifdef block has? you can remove get_part_for_buf() too. And part of the comment, which will be no longer relevant. Only a couple of lines of the comment and bitmap_is_set() can stay. Removed get_part_for_buf() and trimmed the comment accordingly. The remaining asserts are not tripped w.r.t. this issue so there's no reason to remove them here to my knowledge.
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]

            fa3656ab1ff is ok to push

            serg Sergei Golubchik added a comment - fa3656ab1ff is ok to push
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ycp Yuchen Pei added a comment -

            thanks for the review - pushed d3b84ff10d855fa4b4fc42dcbe542f045f6cc970 to 10.5

            ycp Yuchen Pei added a comment - thanks for the review - pushed d3b84ff10d855fa4b4fc42dcbe542f045f6cc970 to 10.5
            ycp Yuchen Pei made changes -
            Fix Version/s 10.5.27 [ 29902 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.4 [ 29301 ]
            Fix Version/s 11.6 [ 29515 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.6.20 [ 29903 ]
            Fix Version/s 10.11.10 [ 29904 ]
            Fix Version/s 11.2.6 [ 29906 ]
            Fix Version/s 11.4.4 [ 29907 ]

            People

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