mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
merge with 3.23.49
BitKeeper/etc/logging_ok: auto-union acconfig.h: Auto merged Docs/manual.texi: Auto merged client/client_priv.h: Auto merged include/mysql.h: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/row/row0mysql.c: Auto merged mysql-test/t/comments.test: Auto merged sql/sql_lex.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/unireg.cc: Auto merged sql/unireg.h: Auto merged
This commit is contained in:
commit
5fa6df3081
22 changed files with 213 additions and 61 deletions
|
|
@ -195,21 +195,6 @@ dict_mutex_exit_for_mysql(void)
|
|||
mutex_exit(&(dict_sys->mutex));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Increments the count of open MySQL handles to a table. */
|
||||
|
||||
void
|
||||
dict_table_increment_handle_count(
|
||||
/*==============================*/
|
||||
dict_table_t* table) /* in: table */
|
||||
{
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
table->n_mysql_handles_opened++;
|
||||
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Decrements the count of open MySQL handles to a table. */
|
||||
|
||||
|
|
@ -495,6 +480,41 @@ dict_table_get(
|
|||
return(table);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Returns a table object and increments MySQL open handle count on the table.
|
||||
*/
|
||||
|
||||
dict_table_t*
|
||||
dict_table_get_and_increment_handle_count(
|
||||
/*======================================*/
|
||||
/* out: table, NULL if does not exist */
|
||||
char* table_name, /* in: table name */
|
||||
trx_t* trx) /* in: transaction handle or NULL */
|
||||
{
|
||||
dict_table_t* table;
|
||||
|
||||
UT_NOT_USED(trx);
|
||||
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
table = dict_table_get_low(table_name);
|
||||
|
||||
if (table != NULL) {
|
||||
|
||||
table->n_mysql_handles_opened++;
|
||||
}
|
||||
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
|
||||
if (table != NULL) {
|
||||
if (!table->stat_initialized) {
|
||||
dict_update_statistics(table);
|
||||
}
|
||||
}
|
||||
|
||||
return(table);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Adds a table object to the dictionary cache. */
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,6 @@ Created 1/8/1996 Heikki Tuuri
|
|||
#include "ut0byte.h"
|
||||
#include "trx0types.h"
|
||||
|
||||
/************************************************************************
|
||||
Increments the count of open MySQL handles to a table. */
|
||||
|
||||
void
|
||||
dict_table_increment_handle_count(
|
||||
/*==============================*/
|
||||
dict_table_t* table); /* in: table */
|
||||
/************************************************************************
|
||||
Decrements the count of open MySQL handles to a table. */
|
||||
|
||||
|
|
@ -195,6 +188,16 @@ dict_table_get(
|
|||
char* table_name, /* in: table name */
|
||||
trx_t* trx); /* in: transaction handle */
|
||||
/**************************************************************************
|
||||
Returns a table object and increments MySQL open handle count on the table.
|
||||
*/
|
||||
|
||||
dict_table_t*
|
||||
dict_table_get_and_increment_handle_count(
|
||||
/*======================================*/
|
||||
/* out: table, NULL if does not exist */
|
||||
char* table_name, /* in: table name */
|
||||
trx_t* trx); /* in: transaction handle or NULL */
|
||||
/**************************************************************************
|
||||
Returns a table object, based on table id, and memoryfixes it. */
|
||||
|
||||
dict_table_t*
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
@ -1468,6 +1466,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);
|
||||
|
|
@ -1477,10 +1482,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);
|
||||
|
|
@ -1746,6 +1757,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;
|
||||
|
|
@ -1807,6 +1825,7 @@ row_drop_database_for_mysql(
|
|||
char* name, /* in: database name which ends to '/' */
|
||||
trx_t* trx) /* in: transaction handle */
|
||||
{
|
||||
dict_table_t* table;
|
||||
char* table_name;
|
||||
int err = DB_SUCCESS;
|
||||
|
||||
|
|
@ -1817,12 +1836,35 @@ row_drop_database_for_mysql(
|
|||
trx->op_info = (char *) "dropping database";
|
||||
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
loop:
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
while ((table_name = dict_get_first_table_name_in_db(name))) {
|
||||
ut_a(memcmp(table_name, name, strlen(name)) == 0);
|
||||
|
||||
table = dict_table_get_low(table_name);
|
||||
|
||||
ut_a(table);
|
||||
|
||||
/* Wait until MySQL does not have any queries running on
|
||||
the table */
|
||||
|
||||
if (table->n_mysql_handles_opened > 0) {
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Warning: MySQL is trying to drop database %s\n"
|
||||
"InnoDB: though there are still open handles to table %s.\n",
|
||||
name, table_name);
|
||||
|
||||
os_thread_sleep(1000000);
|
||||
|
||||
mem_free(table_name);
|
||||
|
||||
goto loop;
|
||||
}
|
||||
|
||||
err = row_drop_table_for_mysql(table_name, trx, TRUE);
|
||||
|
||||
mem_free(table_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue