Commit 3f535154 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) ||...

MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob

close table->update_handler in close_thread_tables().
it's not enough to do it in sql_update.cc only, because
sql_insert.cc can also do updates (REPLACE) and even
sql_delete.cc can (DELETE ... FOR PORTION OF)
parent 20c89f9f
...@@ -20,3 +20,9 @@ t1 CREATE TABLE `t1` ( ...@@ -20,3 +20,9 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`) USING HASH UNIQUE KEY `b` (`b`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam;
insert into t1 values (1,'foo');
replace into t1 (pk) values (1);
alter table t1 force;
replace into t1 (pk) values (1);
drop table t1;
...@@ -26,3 +26,13 @@ alter table t1 add unique (b); ...@@ -26,3 +26,13 @@ alter table t1 add unique (b);
alter table t1 force; alter table t1 force;
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob
#
create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam;
insert into t1 values (1,'foo');
replace into t1 (pk) values (1);
alter table t1 force;
replace into t1 (pk) values (1);
drop table t1;
...@@ -850,12 +850,16 @@ void close_thread_tables(THD *thd) ...@@ -850,12 +850,16 @@ void close_thread_tables(THD *thd)
DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt || DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||
(thd->state_flags & Open_tables_state::BACKUPS_AVAIL)); (thd->state_flags & Open_tables_state::BACKUPS_AVAIL));
/* Detach MERGE children after every statement. Even under LOCK TABLES. */
for (table= thd->open_tables; table; table= table->next) for (table= thd->open_tables; table; table= table->next)
{ {
if (table->update_handler)
table->delete_update_handler();
/* Table might be in use by some outer statement. */ /* Table might be in use by some outer statement. */
DBUG_PRINT("tcache", ("table: '%s' query_id: %lu", DBUG_PRINT("tcache", ("table: '%s' query_id: %lu",
table->s->table_name.str, (ulong) table->query_id)); table->s->table_name.str, (ulong) table->query_id));
/* Detach MERGE children after every statement. Even under LOCK TABLES. */
if (thd->locked_tables_mode <= LTM_LOCK_TABLES || if (thd->locked_tables_mode <= LTM_LOCK_TABLES ||
table->query_id == thd->query_id) table->query_id == thd->query_id)
{ {
......
...@@ -1137,8 +1137,6 @@ int mysql_update(THD *thd, ...@@ -1137,8 +1137,6 @@ int mysql_update(THD *thd,
break; break;
} }
} }
if (table->update_handler)
table->delete_update_handler();
ANALYZE_STOP_TRACKING(&explain->command_tracker); ANALYZE_STOP_TRACKING(&explain->command_tracker);
table->auto_increment_field_not_null= FALSE; table->auto_increment_field_not_null= FALSE;
dup_key_found= 0; dup_key_found= 0;
...@@ -2371,8 +2369,6 @@ multi_update::~multi_update() ...@@ -2371,8 +2369,6 @@ multi_update::~multi_update()
for (table= update_tables ; table; table= table->next_local) for (table= update_tables ; table; table= table->next_local)
{ {
table->table->no_keyread= 0; table->table->no_keyread= 0;
if (table->table->update_handler)
table->table->delete_update_handler();
if (ignore) if (ignore)
table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
} }
......
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