[MDEV-22172] Assertion `inited == NONE || lookup_handler != this' failed in handler::ha_write_row Created: 2020-04-07  Updated: 2020-08-18

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Update, Versioned Tables
Affects Version/s: 10.5
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: regression


 Description   

CREATE TABLE t1 (a CHAR(8), b TEXT, UNIQUE(b)) WITH SYSTEM VERSIONING;
INSERT INTO t1 VALUES  ('foo','bar'),('bar','foo');
 
CREATE TABLE t2 (c INT);
INSERT INTO t2 VALUES (1),(2);
 
UPDATE t1, t2 SET t1.a = 'qux';
 
# Cleanup
DROP TABLE t1, t2;

10.5 13911752

mysqld: /data/src/10.5/sql/handler.cc:6946: int handler::ha_write_row(const uchar*): Assertion `inited == NONE || lookup_handler != this' failed.
200407  1:27:04 [ERROR] mysqld got signal 6 ;
 
#6  0x00007f24e7095e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5570127ffc78 "inited == NONE || lookup_handler != this", file=file@entry=0x5570127fd5be "/data/src/10.5/sql/handler.cc", line=line@entry=6946, function=function@entry=0x557012802220 <handler::ha_write_row(unsigned char const*)::__PRETTY_FUNCTION__> "int handler::ha_write_row(const uchar*)") at assert.c:92
#7  0x00007f24e7095f12 in __GI___assert_fail (assertion=0x5570127ffc78 "inited == NONE || lookup_handler != this", file=0x5570127fd5be "/data/src/10.5/sql/handler.cc", line=6946, function=0x557012802220 <handler::ha_write_row(unsigned char const*)::__PRETTY_FUNCTION__> "int handler::ha_write_row(const uchar*)") at assert.c:101
#8  0x0000557011be4ab8 in handler::ha_write_row (this=0x7f24d00f9c00, buf=0x7f24d01abeb8 "\370foo     \003") at /data/src/10.5/sql/handler.cc:6946
#9  0x000055701182fa86 in vers_insert_history_row (table=0x7f24d00f8d88) at /data/src/10.5/sql/sql_insert.cc:1719
#10 0x00005570119a57dd in multi_update::send_data (this=0x7f24d0014ab8, not_used_values=...) at /data/src/10.5/sql/sql_update.cc:2559
#11 0x000055701191a2e5 in select_result_sink::send_data_with_check (this=0x7f24d0014ab8, items=..., u=0x7f24d0004b20, sent=0) at /data/src/10.5/sql/sql_class.h:5236
#12 0x0000557011901266 in end_send (join=0x7f24d0015128, join_tab=0x7f24d00183d8, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:21795
#13 0x00005570118fe8fa in evaluate_join_record (join=0x7f24d0015128, join_tab=0x7f24d0018030, error=0) at /data/src/10.5/sql/sql_select.cc:20826
#14 0x00005570118fe1bb in sub_select (join=0x7f24d0015128, join_tab=0x7f24d0018030, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:20603
#15 0x00005570118fe8fa in evaluate_join_record (join=0x7f24d0015128, join_tab=0x7f24d0017c88, error=0) at /data/src/10.5/sql/sql_select.cc:20826
#16 0x00005570118fe1bb in sub_select (join=0x7f24d0015128, join_tab=0x7f24d0017c88, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:20603
#17 0x00005570118fd61a in do_select (join=0x7f24d0015128, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20137
#18 0x00005570118d1447 in JOIN::exec_inner (this=0x7f24d0015128) at /data/src/10.5/sql/sql_select.cc:4463
#19 0x00005570118d0573 in JOIN::exec (this=0x7f24d0015128) at /data/src/10.5/sql/sql_select.cc:4244
#20 0x00005570118d1ca4 in mysql_select (thd=0x7f24d0000b18, tables=0x7f24d0013a18, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2200096997504, result=0x7f24d0014ab8, unit=0x7f24d0004b20, select_lex=0x7f24d0005320) at /data/src/10.5/sql/sql_select.cc:4668
#21 0x00005570119a3441 in mysql_multi_update (thd=0x7f24d0000b18, table_list=0x7f24d0013a18, fields=0x7f24d0005470, values=0x7f24d00059e8, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f24d0004b20, select_lex=0x7f24d0005320, result=0x7f24e1c33050) at /data/src/10.5/sql/sql_update.cc:1925
#22 0x000055701187f45f in mysql_execute_command (thd=0x7f24d0000b18) at /data/src/10.5/sql/sql_parse.cc:4439
#23 0x000055701188ba8c in mysql_parse (thd=0x7f24d0000b18, rawbuf=0x7f24d0013930 "UPDATE t1, t2 SET t1.a = 'qux'", length=30, parser_state=0x7f24e1c33520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7953
#24 0x00005570118772dd in dispatch_command (command=COM_QUERY, thd=0x7f24d0000b18, packet=0x7f24d0008699 "UPDATE t1, t2 SET t1.a = 'qux'", packet_length=30, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
#25 0x0000557011875a13 in do_command (thd=0x7f24d0000b18) at /data/src/10.5/sql/sql_parse.cc:1359
#26 0x0000557011a19913 in do_handle_one_connection (connect=0x557015122348, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
#27 0x0000557011a19642 in handle_one_connection (arg=0x557015122348) at /data/src/10.5/sql/sql_connect.cc:1319
#28 0x0000557011f4e8ea in pfs_spawn_thread (arg=0x5570150cbfd8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#29 0x00007f24e901e4a4 in start_thread (arg=0x7f24e1c34700) at pthread_create.c:456
#30 0x00007f24e7152d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible with at least MyISAM, InnoDB.
Not reproducible on 10.4.
No obvious immediate effect on a non-debug build.

The problem appeared in 10.5 tree after this commit:

commit 0515577d128318e1b62511846d88d0c56226168d
Author: Sergei Golubchik
Date:   Thu Mar 5 19:19:57 2020 +0100
 
    cleanup: prepare "update_handler" for WITHOUT OVERLAPS
    
    * rename to a generic name
    * move remaning initializations from query exec to prepare time
    * simplify/unify key handling in open_table_from_share and delayed
    * remove dead code
    * move tests where they belong


Generated at Thu Feb 08 09:12:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.