mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
dict0dict.h, dict0dict.c, row0mysql.c, ha_innobase.cc:
Add some more safety if MySQL tries to drop a table on which there are open handles sql/ha_innobase.cc: Add some more safety if MySQL tries to drop a table on which there are open handles innobase/row/row0mysql.c: Add some more safety if MySQL tries to drop a table on which there are open handles innobase/dict/dict0dict.c: Add some more safety if MySQL tries to drop a table on which there are open handles innobase/include/dict0dict.h: Add some more safety if MySQL tries to drop a table on which there are open handles
This commit is contained in:
@ -273,8 +273,6 @@ row_create_prebuilt(
|
||||
ulint ref_len;
|
||||
ulint i;
|
||||
|
||||
dict_table_increment_handle_count(table);
|
||||
|
||||
heap = mem_heap_create(128);
|
||||
|
||||
prebuilt = mem_heap_alloc(heap, sizeof(row_prebuilt_t));
|
||||
@ -1466,6 +1464,13 @@ loop:
|
||||
table = dict_table_get_low(drop->table_name);
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
|
||||
if (table == NULL) {
|
||||
/* If for some reason the table has already been dropped
|
||||
through some other mechanism, do not try to drop it */
|
||||
|
||||
goto already_dropped;
|
||||
}
|
||||
|
||||
if (table->n_mysql_handles_opened > 0) {
|
||||
|
||||
return(n_tables + n_tables_dropped);
|
||||
@ -1475,10 +1480,16 @@ loop:
|
||||
|
||||
row_drop_table_for_mysql_in_background(drop->table_name);
|
||||
|
||||
already_dropped:
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Dropped table %s in background drop queue.\n",
|
||||
drop->table_name);
|
||||
|
||||
mem_free(drop->table_name);
|
||||
|
||||
mem_free(drop);
|
||||
@ -1741,6 +1752,13 @@ row_drop_table_for_mysql(
|
||||
|
||||
if (table->n_mysql_handles_opened > 0) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Warning: MySQL is trying to drop table %s\n"
|
||||
"InnoDB: though there are still open handles to it.\n"
|
||||
"InnoDB: Adding the table to the background drop queue.\n",
|
||||
table->name);
|
||||
|
||||
row_add_table_to_background_drop_list(table);
|
||||
|
||||
err = DB_SUCCESS;
|
||||
|
Reference in New Issue
Block a user