Improve update handler (long unique keys on blobs) (MDEV-21606)

[MDEV-21627] Assertion `inited == NONE || update_handler != this' failed in handler::ha_write_row Created: 2020-02-01  Updated: 2020-02-08  Resolved: 2020-02-08

Status: Closed
Project: MariaDB Server
Component/s: Server, Versioned Tables
Affects Version/s: N/A
Fix Version/s: N/A

Type: Technical task Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE TABLE t1 (f VARCHAR(4096), s DATE, e DATE, PERIOD FOR app(s,e), UNIQUE(f)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('foo', '2023-08-30', '2025-07-09'),('bar', '2021-01-01', '2021-12-31');
DELETE FROM t1 FOR PORTION OF app FROM '2023-08-29' TO '2025-07-01';
 
# Cleanup
DROP TABLE t1;

bb-10.5-monty b834d1fc

mysqld: /data/src/bb-10.5-monty/sql/handler.cc:6706: int handler::ha_write_row(const uchar*): Assertion `inited == NONE || update_handler != this' failed.
200201 17:59:07 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f26b79d7f12 in __GI___assert_fail (assertion=0x562045277aa0 "inited == NONE || update_handler != this", file=0x5620452755d8 "/data/src/bb-10.5-monty/sql/handler.cc", line=6706, function=0x562045279fa0 <handler::ha_write_row(unsigned char const*)::__PRETTY_FUNCTION__> "int handler::ha_write_row(const uchar*)") at assert.c:101
#8  0x00005620446b8e27 in handler::ha_write_row (this=0x7f26a01308b8, buf=0x7f26a013a0e8 "\374\003") at /data/src/bb-10.5-monty/sql/handler.cc:6706
#9  0x00005620444aa7c6 in TABLE::period_make_insert (this=0x7f26a012f5e0, src=0x7f26a0013da0, dst=0x7f26a0130570) at /data/src/bb-10.5-monty/sql/table.cc:8567
#10 0x00005620444aa9f3 in TABLE::insert_portion_of_time (this=0x7f26a012f5e0, thd=0x7f26a0000b00, period_conds=..., rows_inserted=0x7f26b2382570) at /data/src/bb-10.5-monty/sql/table.cc:8597
#11 0x000056204487c591 in mysql_delete (thd=0x7f26a0000b00, table_list=0x7f26a0013600, conds=0x7f26a0014a90, order_list=0x7f26a00054e0, limit=18446744073709551615, options=0, result=0x0) at /data/src/bb-10.5-monty/sql/sql_delete.cc:794
#12 0x0000562044361c9b in mysql_execute_command (thd=0x7f26a0000b00) at /data/src/bb-10.5-monty/sql/sql_parse.cc:4739
#13 0x000056204436d599 in mysql_parse (thd=0x7f26a0000b00, rawbuf=0x7f26a00134c8 "DELETE FROM t1 FOR PORTION OF app FROM '2023-08-29' TO '2025-07-01'", length=67, parser_state=0x7f26b2383570, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-monty/sql/sql_parse.cc:7990
#14 0x00005620443585a9 in dispatch_command (command=COM_QUERY, thd=0x7f26a0000b00, packet=0x7f26a0008461 "DELETE FROM t1 FOR PORTION OF app FROM '2023-08-29' TO '2025-07-01'", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-monty/sql/sql_parse.cc:1846
#15 0x0000562044356d03 in do_command (thd=0x7f26a0000b00) at /data/src/bb-10.5-monty/sql/sql_parse.cc:1364
#16 0x00005620444f8b85 in do_handle_one_connection (connect=0x562047de2740, put_in_cache=true) at /data/src/bb-10.5-monty/sql/sql_connect.cc:1422
#17 0x00005620444f88b4 in handle_one_connection (arg=0x562047de2740) at /data/src/bb-10.5-monty/sql/sql_connect.cc:1319
#18 0x0000562044a5514b in pfs_spawn_thread (arg=0x562047de2380) at /data/src/bb-10.5-monty/storage/perfschema/pfs.cc:1869
#19 0x00007f26b99604a4 in start_thread (arg=0x7f26b2384700) at pthread_create.c:456
#20 0x00007f26b7a94d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

The assertion was added in this commit

commit 574eb36c14d4ca2022c7803bd5c94076937df16a
Author: Monty
Date:   Mon Jan 13 18:30:13 2020 +0200
 
    Improve update handler (long unique keys on blobs)
    
    MDEV-21606 Improve update handler (long unique keys on blobs)
    MDEV-21470 MyISAM and Aria start_bulk_insert doesn't work with long unique

so naturally it's not reproducible on 10.5 main tree.
Not reproducible with InnoDB.



 Comments   
Comment by Michael Widenius [ 2020-02-08 ]

I had missed to take care of all cases with versioning and long uniq
Now also fixed for delete, multi-table-delete and multi-table-update

Comment by Michael Widenius [ 2020-02-08 ]

Fix pushed to bb-10.5-monty

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