Commit afca9768 authored by Nikita Malyavin's avatar Nikita Malyavin

MDEV-22639 Assertion failed in ha_check_overlaps upon multi-table update

After Sergei's cleanup this assertion is not actual anymore -- we can't
predict if the handler was used for lookup, especially in multi-update
scenario.

`position(old_data)` is made earlier in `ha_check_overlaps`, therefore it
is guaranteed that we compare right refs.
parent d543363f
...@@ -329,4 +329,12 @@ unique(f, p without overlaps)); ...@@ -329,4 +329,12 @@ unique(f, p without overlaps));
insert into t1 values (0,'2026-02-12','2036-09-16'), insert into t1 values (0,'2026-02-12','2036-09-16'),
(null,'2025-03-09','2032-12-05'); (null,'2025-03-09','2032-12-05');
update ignore t join t1 set f = a; update ignore t join t1 set f = a;
# MDEV-22639 Assertion `inited != NONE' failed in
# handler::ha_check_overlaps upon multi-table update
create or replace table t (f int, s date, e date, period for p(s,e),
unique(f, p without overlaps)) engine=myisam;
insert into t values (1,'1988-08-25','2024-03-06');
create or replace table t1 (a int) engine=myisam;
insert into t1 values (1),(2);
update t join t1 set s = '2020-01-01';
drop table t, t1; drop table t, t1;
...@@ -313,5 +313,15 @@ insert into t1 values (0,'2026-02-12','2036-09-16'), ...@@ -313,5 +313,15 @@ insert into t1 values (0,'2026-02-12','2036-09-16'),
update ignore t join t1 set f = a; update ignore t join t1 set f = a;
--echo # MDEV-22639 Assertion `inited != NONE' failed in
--echo # handler::ha_check_overlaps upon multi-table update
create or replace table t (f int, s date, e date, period for p(s,e),
unique(f, p without overlaps)) engine=myisam;
insert into t values (1,'1988-08-25','2024-03-06');
create or replace table t1 (a int) engine=myisam;
insert into t1 values (1),(2);
update t join t1 set s = '2020-01-01';
drop table t, t1; drop table t, t1;
...@@ -6947,7 +6947,7 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data) ...@@ -6947,7 +6947,7 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
uchar *record_buffer= lookup_buffer + table_share->max_unique_length uchar *record_buffer= lookup_buffer + table_share->max_unique_length
+ table_share->null_fields; + table_share->null_fields;
// Needs to compare record refs later is old_row_found() // Needed to compare record refs later
if (is_update) if (is_update)
position(old_data); position(old_data);
...@@ -7003,12 +7003,8 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data) ...@@ -7003,12 +7003,8 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
/* In case of update it could happen that the nearest neighbour is /* In case of update it could happen that the nearest neighbour is
a record we are updating. It means, that there are no overlaps a record we are updating. It means, that there are no overlaps
from this side. from this side.
An assumption is made that during update we always have the last
fetched row in old_data. Therefore, comparing ref's is enough
*/ */
DBUG_ASSERT(lookup_handler != this); DBUG_ASSERT(lookup_handler != this);
DBUG_ASSERT(inited != NONE);
DBUG_ASSERT(ref_length == lookup_handler->ref_length); DBUG_ASSERT(ref_length == lookup_handler->ref_length);
lookup_handler->position(record_buffer); lookup_handler->position(record_buffer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment