Commit 937dfb74 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or...

MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key

even if we're *allowed to* convert DELETE .. FOR PERIOD OF
into an update internally, doesn't think we'll *be able to*.

We always have to prepare for insert.
parent 18502f99
...@@ -368,3 +368,7 @@ drop procedure sp; ...@@ -368,3 +368,7 @@ drop procedure sp;
drop table t,t2,t3,log_tbl; drop table t,t2,t3,log_tbl;
drop view v; drop view v;
drop procedure log; drop procedure log;
create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,se without overlaps));
insert into t1 values (1,'2020-01-01','2020-02-20');
delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1;
...@@ -198,3 +198,11 @@ drop procedure sp; ...@@ -198,3 +198,11 @@ drop procedure sp;
drop table t,t2,t3,log_tbl; drop table t,t2,t3,log_tbl;
drop view v; drop view v;
drop procedure log; drop procedure log;
#
# MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key
#
create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,se without overlaps));
insert into t1 values (1,'2020-01-01','2020-02-20');
delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1;
...@@ -753,8 +753,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -753,8 +753,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
&& !table->versioned() && !table->versioned()
&& table->file->has_transactions(); && table->file->has_transactions();
if (table->versioned(VERS_TIMESTAMP) || if (table->versioned(VERS_TIMESTAMP) || (table_list->has_period()))
(table_list->has_period() && !portion_of_time_through_update))
table->file->prepare_for_insert(1); table->file->prepare_for_insert(1);
DBUG_ASSERT(table->file->inited != handler::NONE); DBUG_ASSERT(table->file->inited != handler::NONE);
......
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