summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2020-10-20 19:19:36 +1000
committerNikita Malyavin <nikitamalyavin@gmail.com>2020-11-02 14:11:43 +1000
commitafca976885ca03556a4f0b18b3a2b8c91155f779 (patch)
treef4ec141d3da0c432709e5dffc42a380216a88fc2
parentd543363f25f96a6cf1779904ea483c59effa1796 (diff)
downloadmariadb-git-afca976885ca03556a4f0b18b3a2b8c91155f779.tar.gz
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.
-rw-r--r--mysql-test/suite/period/r/overlaps.result8
-rw-r--r--mysql-test/suite/period/t/overlaps.test10
-rw-r--r--sql/handler.cc6
3 files changed, 19 insertions, 5 deletions
diff --git a/mysql-test/suite/period/r/overlaps.result b/mysql-test/suite/period/r/overlaps.result
index f5839a84e4b..40d38fc5a56 100644
--- a/mysql-test/suite/period/r/overlaps.result
+++ b/mysql-test/suite/period/r/overlaps.result
@@ -329,4 +329,12 @@ unique(f, p without overlaps));
insert into t1 values (0,'2026-02-12','2036-09-16'),
(null,'2025-03-09','2032-12-05');
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;
diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test
index ef2161d27a2..17005878385 100644
--- a/mysql-test/suite/period/t/overlaps.test
+++ b/mysql-test/suite/period/t/overlaps.test
@@ -313,5 +313,15 @@ insert into t1 values (0,'2026-02-12','2036-09-16'),
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;
diff --git a/sql/handler.cc b/sql/handler.cc
index aa04b0bce1c..038effc3e5b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -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
+ table_share->null_fields;
- // Needs to compare record refs later is old_row_found()
+ // Needed to compare record refs later
if (is_update)
position(old_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
a record we are updating. It means, that there are no overlaps
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(inited != NONE);
DBUG_ASSERT(ref_length == lookup_handler->ref_length);
lookup_handler->position(record_buffer);