[MDEV-31030] Assertion `!error' failed in ha_partition::update_row on UPDATE Created: 2023-04-08  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Update, Partitioning
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Note: the IGNORE is required, which is the likely oversight as without it we get ERROR 1365 (22012): Division by 0 on the INSERT. Affects all major engines.

CREATE TABLE t (c INT) PARTITION BY LIST (1 DIV c) (PARTITION p0 VALUES IN (NULL),PARTITION p VALUES IN (1));
INSERT IGNORE INTO t VALUES (0),(1),(0);
UPDATE t SET c=1;

Leads to:

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

mariadbd: /test/11.1_dbg/sql/ha_partition.cc:4645: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `!error' failed.

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

Core was generated by `/test/MD070423-mariadb-11.1.0-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=23003202373184)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x14ebd9b4c640 (LWP 2344389))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23003202373184) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23003202373184) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23003202373184, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x000014ebf74d1476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x000014ebf74b77f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x000014ebf74b771b in __assert_fail_base (fmt=0x14ebf766c150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x564cd4805ed4 "!error", file=0x564cd486b158 "/test/11.1_dbg/sql/ha_partition.cc", line=4645, function=<optimized out>) at ./assert/assert.c:92
#6  0x000014ebf74c8e96 in __GI___assert_fail (assertion=0x564cd4805ed4 "!error", file=0x564cd486b158 "/test/11.1_dbg/sql/ha_partition.cc", line=4645, function=0x564cd486cc50 "virtual int ha_partition::update_row(const uchar*, const uchar*)") at ./assert/assert.c:101
#7  0x0000564cd40c349d in ha_partition::update_row (this=0x14eb8c01e390, old_data=0x14eb8c01df98 <incomplete sequence \375>, new_data=0x14eb8c01df90 "\375\001") at /test/11.1_dbg/sql/ha_partition.cc:4645
#8  0x0000564cd3e42655 in handler::ha_update_row (this=0x14eb8c01e390, old_data=0x14eb8c01df98 <incomplete sequence \375>, new_data=0x14eb8c01df90 "\375\001") at /test/11.1_dbg/sql/handler.cc:7848
#9  0x0000564cd3c6a001 in Sql_cmd_update::update_single_table (this=<optimized out>, thd=0x14eb8c000d58) at /test/11.1_dbg/sql/sql_update.cc:981
#10 0x0000564cd3c6ae57 in Sql_cmd_update::execute_inner (this=0x14eb8c013b50, thd=0x14eb8c000d58) at /test/11.1_dbg/sql/sql_update.cc:3052
#11 0x0000564cd3ba4c80 in Sql_cmd_dml::execute (this=0x14eb8c013b50, thd=0x14eb8c000d58) at /test/11.1_dbg/sql/sql_select.cc:32536
#12 0x0000564cd3b65b7c in mysql_execute_command (thd=thd@entry=0x14eb8c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.1_dbg/sql/sql_parse.cc:4393
#13 0x0000564cd3b6af05 in mysql_parse (thd=thd@entry=0x14eb8c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ebd9b4b230) at /test/11.1_dbg/sql/sql_parse.cc:7760
#14 0x0000564cd3b6d099 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14eb8c000d58, packet=packet@entry=0x14eb8c00ae49 "UPDATE t SET c=1", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_class.h:242
#15 0x0000564cd3b6eef5 in do_command (thd=0x14eb8c000d58, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:1405
#16 0x0000564cd3cc0cfc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x564cd6775148, put_in_cache=put_in_cache@entry=true) at /test/11.1_dbg/sql/sql_connect.cc:1416
#17 0x0000564cd3cc0f5b in handle_one_connection (arg=0x564cd6775148) at /test/11.1_dbg/sql/sql_connect.cc:1318
#18 0x000014ebf7523b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#19 0x000014ebf75b5a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

11.0.2 8e55d7ea4a2f94ae3f38fdd8785778612d4b1203 (Debug)

mariadbd: /test/11.0_dbg/sql/ha_partition.cc:4645: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `!error' failed.

11.0.2 8e55d7ea4a2f94ae3f38fdd8785778612d4b1203 (Debug)

Core was generated by `/test/MD070423-mariadb-11.0.2-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=23046125602368)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x14f5d8214640 (LWP 2344390))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23046125602368) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23046125602368) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23046125602368, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x000014f604db4476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x000014f604d9a7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x000014f604d9a71b in __assert_fail_base (fmt=0x14f604f4f150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e098f47bb4 "!error", file=0x55e098face38 "/test/11.0_dbg/sql/ha_partition.cc", line=4645, function=<optimized out>) at ./assert/assert.c:92
#6  0x000014f604dabe96 in __GI___assert_fail (assertion=0x55e098f47bb4 "!error", file=0x55e098face38 "/test/11.0_dbg/sql/ha_partition.cc", line=4645, function=0x55e098fae930 "virtual int ha_partition::update_row(const uchar*, const uchar*)") at ./assert/assert.c:101
#7  0x000055e0987feacf in ha_partition::update_row (this=0x14f56c01e380, old_data=0x14f56c01df88 <incomplete sequence \375>, new_data=0x14f56c01df80 "\375\001") at /test/11.0_dbg/sql/ha_partition.cc:4645
#8  0x000055e09857dc9b in handler::ha_update_row (this=0x14f56c01e380, old_data=0x14f56c01df88 <incomplete sequence \375>, new_data=0x14f56c01df80 "\375\001") at /test/11.0_dbg/sql/handler.cc:7848
#9  0x000055e0983a83ea in mysql_update (thd=thd@entry=0x14f56c000d58, table_list=<optimized out>, fields=@0x14f56c005a88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f56c013b18, last = 0x14f56c013b18, elements = 1}, <No data fields>}, values=@0x14f56c005ed8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f56c013b28, last = 0x14f56c013b28, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551615, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /test/11.0_dbg/sql/sql_update.cc:1101
#10 0x000055e0982a0d41 in mysql_execute_command (thd=thd@entry=0x14f56c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:4412
#11 0x000055e0982a6c39 in mysql_parse (thd=thd@entry=0x14f56c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f5d8213240) at /test/11.0_dbg/sql/sql_parse.cc:7999
#12 0x000055e0982a8dcd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f56c000d58, packet=packet@entry=0x14f56c00ae39 "UPDATE t SET c=1", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242
#13 0x000055e0982aac26 in do_command (thd=0x14f56c000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407
#14 0x000055e0983fcbba in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55e09acf1b68, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416
#15 0x000055e0983fce19 in handle_one_connection (arg=0x55e09acf1b68) at /test/11.0_dbg/sql/sql_connect.cc:1318
#16 0x000014f604e06b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#17 0x000014f604e98a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Bug confirmed present in:
MariaDB: 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.3 (dbg), 11.0.2 (dbg), 11.1.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 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.3 (opt), 11.0.2 (opt), 11.1.0 (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)


Generated at Thu Feb 08 10:20:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.