1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-28 17:36:30 +03:00

Merge 10.0 into 10.1

This commit is contained in:
Marko Mäkelä
2017-12-18 20:05:50 +02:00
13 changed files with 153 additions and 219 deletions

View File

@@ -1348,3 +1348,15 @@ t CREATE TABLE `t` (
KEY `i` (`i`) KEY `i` (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
DROP TABLE t; DROP TABLE t;
#
# MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
#
SET sql_mode=STRICT_ALL_TABLES;
CREATE TABLE t1 (
c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT
) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000;
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
c1
1e19
DROP TABLE t1;

View File

@@ -680,3 +680,15 @@ INSERT INTO t VALUES (NULL);
SELECT * FROM t; SELECT * FROM t;
SHOW CREATE TABLE t; SHOW CREATE TABLE t;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
--echo #
SET sql_mode=STRICT_ALL_TABLES;
CREATE TABLE t1 (
c1 DOUBLE NOT NULL PRIMARY KEY AUTO_INCREMENT
) ENGINE=InnoDB AUTO_INCREMENT=10000000000000000000;
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
DROP TABLE t1;

View File

@@ -0,0 +1,10 @@
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;

View File

@@ -0,0 +1,17 @@
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
--source include/have_partition.inc
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
# Cleanup
DROP TABLE t1;

View File

@@ -4729,7 +4729,7 @@ double Field_double::val_real(void)
return j; return j;
} }
longlong Field_double::val_int(void) longlong Field_double::val_int_from_real(bool want_unsigned_result)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
double j; double j;
@@ -4737,7 +4737,7 @@ longlong Field_double::val_int(void)
bool error; bool error;
float8get(j,ptr); float8get(j,ptr);
res= double_to_longlong(j, 0, &error); res= double_to_longlong(j, want_unsigned_result, &error);
if (error) if (error)
{ {
THD *thd= get_thd(); THD *thd= get_thd();

View File

@@ -745,6 +745,10 @@ public:
{ return store(ls->str, ls->length, cs); } { return store(ls->str, ls->length, cs); }
virtual double val_real(void)=0; virtual double val_real(void)=0;
virtual longlong val_int(void)=0; virtual longlong val_int(void)=0;
virtual ulonglong val_uint(void)
{
return (ulonglong) val_int();
}
virtual bool val_bool(void)= 0; virtual bool val_bool(void)= 0;
virtual my_decimal *val_decimal(my_decimal *); virtual my_decimal *val_decimal(my_decimal *);
inline String *val_str(String *str) { return val_str(str, str); } inline String *val_str(String *str) { return val_str(str, str); }
@@ -1999,6 +2003,7 @@ private:
class Field_double :public Field_real { class Field_double :public Field_real {
longlong val_int_from_real(bool want_unsigned_result);
public: public:
Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar null_bit_arg,
@@ -2025,7 +2030,8 @@ public:
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
int reset(void) { bzero(ptr,sizeof(double)); return 0; } int reset(void) { bzero(ptr,sizeof(double)); return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void) { return val_int_from_real(false); }
ulonglong val_uint(void) { return (ulonglong) val_int_from_real(true); }
String *val_str(String*,String *); String *val_str(String*,String *);
bool send_binary(Protocol *protocol); bool send_binary(Protocol *protocol);
int cmp(const uchar *,const uchar *); int cmp(const uchar *,const uchar *);

View File

@@ -1764,6 +1764,13 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET); used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
return false; return false;
} }
ulong table_options_with_row_type()
{
if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
return table_options | HA_OPTION_PACK_RECORD;
else
return table_options;
}
}; };

View File

@@ -6831,10 +6831,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->part_info= part_info; lpt->part_info= part_info;
lpt->alter_info= alter_info; lpt->alter_info= alter_info;
lpt->create_info= create_info; lpt->create_info= create_info;
lpt->db_options= create_info->table_options; lpt->db_options= create_info->table_options_with_row_type();
if (create_info->row_type != ROW_TYPE_FIXED &&
create_info->row_type != ROW_TYPE_DEFAULT)
lpt->db_options|= HA_OPTION_PACK_RECORD;
lpt->table= table; lpt->table= table;
lpt->key_info_buffer= 0; lpt->key_info_buffer= 0;
lpt->key_count= 0; lpt->key_count= 0;

View File

@@ -4414,10 +4414,7 @@ handler *mysql_create_frm_image(THD *thd,
set_table_default_charset(thd, create_info, (char*) db); set_table_default_charset(thd, create_info, (char*) db);
db_options= create_info->table_options; db_options= create_info->table_options_with_row_type();
if (create_info->row_type == ROW_TYPE_DYNAMIC ||
create_info->row_type == ROW_TYPE_PAGE)
db_options|= HA_OPTION_PACK_RECORD;
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
create_info->db_type))) create_info->db_type)))

View File

@@ -8297,7 +8297,7 @@ no_commit:
table->next_number_field); table->next_number_field);
/* Get the value that MySQL attempted to store in the table.*/ /* Get the value that MySQL attempted to store in the table.*/
auto_inc = table->next_number_field->val_int(); auto_inc = table->next_number_field->val_uint();
switch (error) { switch (error) {
case DB_DUPLICATE_KEY: case DB_DUPLICATE_KEY:
@@ -8891,7 +8891,7 @@ ha_innobase::update_row(
ulonglong auto_inc; ulonglong auto_inc;
ulonglong col_max_value; ulonglong col_max_value;
auto_inc = table->next_number_field->val_int(); auto_inc = table->next_number_field->val_uint();
/* We need the upper limit of the col type to check for /* We need the upper limit of the col type to check for
whether we update the table autoinc counter or not. */ whether we update the table autoinc counter or not. */

View File

@@ -75,7 +75,7 @@ UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
/** Chain node of the list of tables to drop in the background. */ /** Chain node of the list of tables to drop in the background. */
struct row_mysql_drop_t{ struct row_mysql_drop_t{
char* table_name; /*!< table name */ table_id_t table_id; /*!< table id */
UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list; UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list;
/*!< list chain node */ /*!< list chain node */
}; };
@@ -138,19 +138,6 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "db")); || 0 == strcmp(name + 6, "db"));
} }
/*********************************************************************//**
If a table is not yet in the drop list, adds the table to the list of tables
which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the
table lazily.
@return TRUE if the table was not yet in the drop list, and was added there */
static
ibool
row_add_table_to_background_drop_list(
/*==================================*/
const char* name); /*!< in: table name */
/*******************************************************************//** /*******************************************************************//**
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */ Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */
static static
@@ -2770,7 +2757,7 @@ loop:
mutex_enter(&row_drop_list_mutex); mutex_enter(&row_drop_list_mutex);
ut_a(row_mysql_drop_list_inited); ut_a(row_mysql_drop_list_inited);
next:
drop = UT_LIST_GET_FIRST(row_mysql_drop_list); drop = UT_LIST_GET_FIRST(row_mysql_drop_list);
n_tables = UT_LIST_GET_LEN(row_mysql_drop_list); n_tables = UT_LIST_GET_LEN(row_mysql_drop_list);
@@ -2783,62 +2770,39 @@ loop:
return(n_tables + n_tables_dropped); return(n_tables + n_tables_dropped);
} }
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep", table = dict_table_open_on_id(drop->table_id, FALSE,
os_thread_sleep(5000000); DICT_TABLE_OP_NORMAL);
);
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE, if (!table) {
DICT_ERR_IGNORE_NONE); n_tables_dropped++;
mutex_enter(&row_drop_list_mutex);
if (table == NULL) { UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
/* If for some reason the table has already been dropped MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
through some other mechanism, do not try to drop it */ ut_free(drop);
goto next;
goto already_dropped;
}
if (!table->to_be_dropped) {
/* There is a scenario: the old table is dropped
just after it's added into drop list, and new
table with the same name is created, then we try
to drop the new table in background. */
dict_table_close(table, FALSE, FALSE);
goto already_dropped;
} }
ut_a(!table->can_be_evicted); ut_a(!table->can_be_evicted);
if (!table->to_be_dropped) {
dict_table_close(table, FALSE, FALSE);
mutex_enter(&row_drop_list_mutex);
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list,
drop);
goto next;
}
dict_table_close(table, FALSE, FALSE); dict_table_close(table, FALSE, FALSE);
if (DB_SUCCESS != row_drop_table_for_mysql_in_background( if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
drop->table_name)) { table->name)) {
/* If the DROP fails for some table, we return, and let the /* If the DROP fails for some table, we return, and let the
main thread retry later */ main thread retry later */
return(n_tables + n_tables_dropped); return(n_tables + n_tables_dropped);
} }
n_tables_dropped++;
already_dropped:
mutex_enter(&row_drop_list_mutex);
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
ut_print_timestamp(stderr);
fputs(" InnoDB: Dropped table ", stderr);
ut_print_name(stderr, NULL, TRUE, drop->table_name);
fputs(" in background drop queue.\n", stderr);
mem_free(drop->table_name);
mem_free(drop);
mutex_exit(&row_drop_list_mutex);
goto loop; goto loop;
} }
@@ -2870,14 +2834,13 @@ which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the it. Also, if there are running foreign key checks on the table, we drop the
table lazily. table lazily.
@return TRUE if the table was not yet in the drop list, and was added there */ @return whether background DROP TABLE was scheduled for the first time */
static static
ibool bool
row_add_table_to_background_drop_list( row_add_table_to_background_drop_list(table_id_t table_id)
/*==================================*/
const char* name) /*!< in: table name */
{ {
row_mysql_drop_t* drop; row_mysql_drop_t* drop;
bool added = true;
mutex_enter(&row_drop_list_mutex); mutex_enter(&row_drop_list_mutex);
@@ -2888,31 +2851,21 @@ row_add_table_to_background_drop_list(
drop != NULL; drop != NULL;
drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) { drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) {
if (strcmp(drop->table_name, name) == 0) { if (drop->table_id == table_id) {
/* Already in the list */ added = false;
goto func_exit;
mutex_exit(&row_drop_list_mutex);
return(FALSE);
} }
} }
drop = static_cast<row_mysql_drop_t*>( drop = static_cast<row_mysql_drop_t*>(ut_malloc(sizeof *drop));
mem_alloc(sizeof(row_mysql_drop_t))); drop->table_id = table_id;
drop->table_name = mem_strdup(name);
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop); UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE); MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE);
func_exit:
/* fputs("InnoDB: Adding table ", stderr);
ut_print_name(stderr, trx, TRUE, drop->table_name);
fputs(" to background drop list\n", stderr); */
mutex_exit(&row_drop_list_mutex); mutex_exit(&row_drop_list_mutex);
return added;
return(TRUE);
} }
/*********************************************************************//** /*********************************************************************//**
@@ -4131,7 +4084,7 @@ row_drop_table_for_mysql(
DBUG_EXECUTE_IF("row_drop_table_add_to_background", DBUG_EXECUTE_IF("row_drop_table_add_to_background",
row_add_table_to_background_drop_list(table->name); row_add_table_to_background_drop_list(table->id);
err = DB_SUCCESS; err = DB_SUCCESS;
goto funct_exit; goto funct_exit;
); );
@@ -4143,33 +4096,22 @@ row_drop_table_for_mysql(
checks take an IS or IX lock on the table. */ checks take an IS or IX lock on the table. */
if (table->n_foreign_key_checks_running > 0) { if (table->n_foreign_key_checks_running > 0) {
if (row_add_table_to_background_drop_list(table->id)) {
const char* save_tablename = table->name;
ibool added;
added = row_add_table_to_background_drop_list(save_tablename);
if (added) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: You are trying to drop table ", fputs(" InnoDB: You are trying to drop table ",
stderr); stderr);
ut_print_name(stderr, trx, TRUE, save_tablename); ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n" fputs("\n"
"InnoDB: though there is a" "InnoDB: though there is a"
" foreign key check running on it.\n" " foreign key check running on it.\n"
"InnoDB: Adding the table to" "InnoDB: Adding the table to"
" the background drop queue.\n", " the background drop queue.\n",
stderr); stderr);
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
err = DB_SUCCESS;
} else {
/* The table is already in the background drop list */
err = DB_ERROR;
} }
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
err = DB_SUCCESS;
goto funct_exit; goto funct_exit;
} }
@@ -4194,11 +4136,7 @@ row_drop_table_for_mysql(
lock_remove_all_on_table(table, TRUE); lock_remove_all_on_table(table, TRUE);
ut_a(table->n_rec_locks == 0); ut_a(table->n_rec_locks == 0);
} else if (table->n_ref_count > 0 || table->n_rec_locks > 0) { } else if (table->n_ref_count > 0 || table->n_rec_locks > 0) {
ibool added; if (row_add_table_to_background_drop_list(table->id)) {
added = row_add_table_to_background_drop_list(table->name);
if (added) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: MySQL is" fputs(" InnoDB: Warning: MySQL is"
" trying to drop table ", stderr); " trying to drop table ", stderr);

View File

@@ -8881,7 +8881,7 @@ no_commit:
table->next_number_field); table->next_number_field);
/* Get the value that MySQL attempted to store in the table.*/ /* Get the value that MySQL attempted to store in the table.*/
auto_inc = table->next_number_field->val_int(); auto_inc = table->next_number_field->val_uint();
switch (error) { switch (error) {
case DB_DUPLICATE_KEY: case DB_DUPLICATE_KEY:
@@ -9473,7 +9473,7 @@ ha_innobase::update_row(
ulonglong auto_inc; ulonglong auto_inc;
ulonglong col_max_value; ulonglong col_max_value;
auto_inc = table->next_number_field->val_int(); auto_inc = table->next_number_field->val_uint();
/* We need the upper limit of the col type to check for /* We need the upper limit of the col type to check for
whether we update the table autoinc counter or not. */ whether we update the table autoinc counter or not. */

View File

@@ -74,7 +74,7 @@ UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
/** Chain node of the list of tables to drop in the background. */ /** Chain node of the list of tables to drop in the background. */
struct row_mysql_drop_t{ struct row_mysql_drop_t{
char* table_name; /*!< table name */ table_id_t table_id; /*!< table id */
UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list; UT_LIST_NODE_T(row_mysql_drop_t)row_mysql_drop_list;
/*!< list chain node */ /*!< list chain node */
}; };
@@ -137,19 +137,6 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "db")); || 0 == strcmp(name + 6, "db"));
} }
/*********************************************************************//**
If a table is not yet in the drop list, adds the table to the list of tables
which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the
table lazily.
@return TRUE if the table was not yet in the drop list, and was added there */
static
ibool
row_add_table_to_background_drop_list(
/*==================================*/
const char* name); /*!< in: table name */
/*******************************************************************//** /*******************************************************************//**
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */ Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. */
static static
@@ -2787,7 +2774,7 @@ loop:
mutex_enter(&row_drop_list_mutex); mutex_enter(&row_drop_list_mutex);
ut_a(row_mysql_drop_list_inited); ut_a(row_mysql_drop_list_inited);
next:
drop = UT_LIST_GET_FIRST(row_mysql_drop_list); drop = UT_LIST_GET_FIRST(row_mysql_drop_list);
n_tables = UT_LIST_GET_LEN(row_mysql_drop_list); n_tables = UT_LIST_GET_LEN(row_mysql_drop_list);
@@ -2800,62 +2787,39 @@ loop:
return(n_tables + n_tables_dropped); return(n_tables + n_tables_dropped);
} }
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep", table = dict_table_open_on_id(drop->table_id, FALSE,
os_thread_sleep(5000000); DICT_TABLE_OP_NORMAL);
);
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE, if (!table) {
DICT_ERR_IGNORE_NONE); n_tables_dropped++;
mutex_enter(&row_drop_list_mutex);
if (table == NULL) { UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
/* If for some reason the table has already been dropped MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
through some other mechanism, do not try to drop it */ ut_free(drop);
goto next;
goto already_dropped;
}
if (!table->to_be_dropped) {
/* There is a scenario: the old table is dropped
just after it's added into drop list, and new
table with the same name is created, then we try
to drop the new table in background. */
dict_table_close(table, FALSE, FALSE);
goto already_dropped;
} }
ut_a(!table->can_be_evicted); ut_a(!table->can_be_evicted);
if (!table->to_be_dropped) {
dict_table_close(table, FALSE, FALSE);
mutex_enter(&row_drop_list_mutex);
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list,
drop);
goto next;
}
dict_table_close(table, FALSE, FALSE); dict_table_close(table, FALSE, FALSE);
if (DB_SUCCESS != row_drop_table_for_mysql_in_background( if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
drop->table_name)) { table->name)) {
/* If the DROP fails for some table, we return, and let the /* If the DROP fails for some table, we return, and let the
main thread retry later */ main thread retry later */
return(n_tables + n_tables_dropped); return(n_tables + n_tables_dropped);
} }
n_tables_dropped++;
already_dropped:
mutex_enter(&row_drop_list_mutex);
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
ut_print_timestamp(stderr);
fputs(" InnoDB: Dropped table ", stderr);
ut_print_name(stderr, NULL, TRUE, drop->table_name);
fputs(" in background drop queue.\n", stderr);
mem_free(drop->table_name);
mem_free(drop);
mutex_exit(&row_drop_list_mutex);
goto loop; goto loop;
} }
@@ -2887,14 +2851,13 @@ which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the it. Also, if there are running foreign key checks on the table, we drop the
table lazily. table lazily.
@return TRUE if the table was not yet in the drop list, and was added there */ @return whether background DROP TABLE was scheduled for the first time */
static static
ibool bool
row_add_table_to_background_drop_list( row_add_table_to_background_drop_list(table_id_t table_id)
/*==================================*/
const char* name) /*!< in: table name */
{ {
row_mysql_drop_t* drop; row_mysql_drop_t* drop;
bool added = true;
mutex_enter(&row_drop_list_mutex); mutex_enter(&row_drop_list_mutex);
@@ -2905,31 +2868,21 @@ row_add_table_to_background_drop_list(
drop != NULL; drop != NULL;
drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) { drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop)) {
if (strcmp(drop->table_name, name) == 0) { if (drop->table_id == table_id) {
/* Already in the list */ added = false;
goto func_exit;
mutex_exit(&row_drop_list_mutex);
return(FALSE);
} }
} }
drop = static_cast<row_mysql_drop_t*>( drop = static_cast<row_mysql_drop_t*>(ut_malloc(sizeof *drop));
mem_alloc(sizeof(row_mysql_drop_t))); drop->table_id = table_id;
drop->table_name = mem_strdup(name);
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop); UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE); MONITOR_INC(MONITOR_BACKGROUND_DROP_TABLE);
func_exit:
/* fputs("InnoDB: Adding table ", stderr);
ut_print_name(stderr, trx, TRUE, drop->table_name);
fputs(" to background drop list\n", stderr); */
mutex_exit(&row_drop_list_mutex); mutex_exit(&row_drop_list_mutex);
return added;
return(TRUE);
} }
/*********************************************************************//** /*********************************************************************//**
@@ -4150,7 +4103,7 @@ row_drop_table_for_mysql(
DBUG_EXECUTE_IF("row_drop_table_add_to_background", DBUG_EXECUTE_IF("row_drop_table_add_to_background",
row_add_table_to_background_drop_list(table->name); row_add_table_to_background_drop_list(table->id);
err = DB_SUCCESS; err = DB_SUCCESS;
goto funct_exit; goto funct_exit;
); );
@@ -4162,33 +4115,22 @@ row_drop_table_for_mysql(
checks take an IS or IX lock on the table. */ checks take an IS or IX lock on the table. */
if (table->n_foreign_key_checks_running > 0) { if (table->n_foreign_key_checks_running > 0) {
if (row_add_table_to_background_drop_list(table->id)) {
const char* save_tablename = table->name;
ibool added;
added = row_add_table_to_background_drop_list(save_tablename);
if (added) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: You are trying to drop table ", fputs(" InnoDB: You are trying to drop table ",
stderr); stderr);
ut_print_name(stderr, trx, TRUE, save_tablename); ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n" fputs("\n"
"InnoDB: though there is a" "InnoDB: though there is a"
" foreign key check running on it.\n" " foreign key check running on it.\n"
"InnoDB: Adding the table to" "InnoDB: Adding the table to"
" the background drop queue.\n", " the background drop queue.\n",
stderr); stderr);
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
err = DB_SUCCESS;
} else {
/* The table is already in the background drop list */
err = DB_ERROR;
} }
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
err = DB_SUCCESS;
goto funct_exit; goto funct_exit;
} }
@@ -4213,11 +4155,7 @@ row_drop_table_for_mysql(
lock_remove_all_on_table(table, TRUE); lock_remove_all_on_table(table, TRUE);
ut_a(table->n_rec_locks == 0); ut_a(table->n_rec_locks == 0);
} else if (table->n_ref_count > 0 || table->n_rec_locks > 0) { } else if (table->n_ref_count > 0 || table->n_rec_locks > 0) {
ibool added; if (row_add_table_to_background_drop_list(table->id)) {
added = row_add_table_to_background_drop_list(table->name);
if (added) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: MySQL is" fputs(" InnoDB: Warning: MySQL is"
" trying to drop table ", stderr); " trying to drop table ", stderr);