Bug #71630 Assertion `! is_set()' fails on UPDATE on a partitioned table with subquery
Submitted: 7 Feb 2014 19:36 Modified: 7 Feb 2014 20:06
Reporter: Elena Stepanova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1, 5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[7 Feb 2014 19:36] Elena Stepanova
Description:
Stack trace from 5.6 revno 5732:

mysqld: mysql-5.6/sql/sql_error.cc:430: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `! is_set()' failed.
19:31:21 UTC - mysqld got signal 6 ;

#6  0x00007fa8dcb5e621 in *__GI___assert_fail (assertion=0xf39f6e "! is_set()", file=<optimized out>, line=430, function=0xf3a860 "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:81
#7  0x00000000007d48da in Diagnostics_area::set_ok_status (this=0x2b3ddd0, affected_rows=0, last_insert_id=0, message=0x0) at mysql-5.6/sql/sql_error.cc:430
#8  0x00000000007927a4 in my_ok (thd=0x2b3a940, affected_rows=0, id=0, message=0x0) at mysql-5.6/sql/sql_class.h:4162
#9  0x0000000000897de7 in mysql_update (thd=0x2b3a940, table_list=0x2c14150, fields=..., values=..., conds=0x2c99388, order_num=1, order=0x2c15dd8, limit=6, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7fa8d500d9b8, updated_return=0x7fa8d500d9b0) at mysql-5.6/sql/sql_update.cc:447
#10 0x000000000080a5b2 in mysql_execute_command (thd=0x2b3a940) at mysql-5.6/sql/sql_parse.cc:3298
#11 0x0000000000812547 in mysql_parse (thd=0x2b3a940, rawbuf=0x2c14010 "UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6", length=69, parser_state=0x7fa8d500de60) at mysql-5.6/sql/sql_parse.cc:6235
#12 0x0000000000805bd5 in dispatch_command (command=COM_QUERY, thd=0x2b3a940, packet=0x2c0fbb1 "UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6", packet_length=69) at mysql-5.6/sql/sql_parse.cc:1334
#13 0x0000000000804d61 in do_command (thd=0x2b3a940) at mysql-5.6/sql/sql_parse.cc:1036
#14 0x00000000007cc7a7 in do_handle_one_connection (thd_arg=0x2b3a940) at mysql-5.6/sql/sql_connect.cc:982
#15 0x00000000007cc2bb in handle_one_connection (arg=0x2b3a940) at mysql-5.6/sql/sql_connect.cc:898
#16 0x0000000000b247a5 in pfs_spawn_thread (arg=0x2b8b100) at mysql-5.6/storage/perfschema/pfs.cc:1858
#17 0x00007fa8ddea7b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#18 0x00007fa8dcc0da7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

How to repeat:
--source include/have_partition.inc

CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;

CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (1),(2);

UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
[7 Feb 2014 20:06] Sveta Smirnova
Thank you for the report.

Verified as described.
[8 Feb 2014 20:57] Mattias Jonsson
Bad error handling. Quick patch:
=== modified file 'sql/sql_update.cc'
--- sql/sql_update.cc
+++ sql/sql_update.cc
@@ -394,6 +394,8 @@ int mysql_update(THD *thd,
   if (prune_partitions(thd, table, conds))
   {
     free_underlaid_joins(thd, select_lex);
+    if (thd->is_error())
+      DBUG_RETURN(1);
     my_ok(thd);                                // No matching records
     DBUG_RETURN(0);
   }