Browse Source

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.
bb-10.5-mdev7317
Sergei Golubchik 6 years ago
parent
commit
937dfb74cb
  1. 4
      mysql-test/suite/period/r/delete.result
  2. 8
      mysql-test/suite/period/t/delete.test
  3. 3
      sql/sql_delete.cc

4
mysql-test/suite/period/r/delete.result

@ -368,3 +368,7 @@ drop procedure sp;
drop table t,t2,t3,log_tbl;
drop view v;
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;

8
mysql-test/suite/period/t/delete.test

@ -198,3 +198,11 @@ drop procedure sp;
drop table t,t2,t3,log_tbl;
drop view v;
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;

3
sql/sql_delete.cc

@ -753,8 +753,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
&& !table->versioned()
&& table->file->has_transactions();
if (table->versioned(VERS_TIMESTAMP) ||
(table_list->has_period() && !portion_of_time_through_update))
if (table->versioned(VERS_TIMESTAMP) || (table_list->has_period()))
table->file->prepare_for_insert(1);
DBUG_ASSERT(table->file->inited != handler::NONE);

Loading…
Cancel
Save