Commit 1d18665e authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into 10.3

parents 705fd4e9 0d7cf06a
...@@ -1510,8 +1510,8 @@ fts_rename_one_aux_table( ...@@ -1510,8 +1510,8 @@ fts_rename_one_aux_table(
table_new_name_len - new_db_name_len); table_new_name_len - new_db_name_len);
fts_table_new_name[table_new_name_len] = 0; fts_table_new_name[table_new_name_len] = 0;
return(row_rename_table_for_mysql( return row_rename_table_for_mysql(
fts_table_old_name, fts_table_new_name, trx, false)); fts_table_old_name, fts_table_new_name, trx, false, false);
} }
/****************************************************************//** /****************************************************************//**
...@@ -6233,7 +6233,7 @@ fts_rename_one_aux_table_to_hex_format( ...@@ -6233,7 +6233,7 @@ fts_rename_one_aux_table_to_hex_format(
} }
error = row_rename_table_for_mysql(aux_table->name, new_name, trx, error = row_rename_table_for_mysql(aux_table->name, new_name, trx,
FALSE); false, false);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
ib::warn() << "Failed to rename aux table '" ib::warn() << "Failed to rename aux table '"
...@@ -6372,7 +6372,7 @@ fts_rename_aux_tables_to_hex_format_low( ...@@ -6372,7 +6372,7 @@ fts_rename_aux_tables_to_hex_format_low(
DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS_AUX_HEX_NAME); DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS_AUX_HEX_NAME);
err = row_rename_table_for_mysql(table->name.m_name, err = row_rename_table_for_mysql(table->name.m_name,
aux_table->name, aux_table->name,
trx_bg, FALSE); trx_bg, false, false);
trx_bg->dict_operation_lock_mode = 0; trx_bg->dict_operation_lock_mode = 0;
dict_table_close(table, TRUE, FALSE); dict_table_close(table, TRUE, FALSE);
......
...@@ -13048,6 +13048,7 @@ innobase_drop_database( ...@@ -13048,6 +13048,7 @@ innobase_drop_database(
@param[in] from old table name @param[in] from old table name
@param[in] to new table name @param[in] to new table name
@param[in] commit whether to commit trx @param[in] commit whether to commit trx
@param[in] use_fk whether to parse and enforce FOREIGN KEY constraints
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
inline inline
dberr_t dberr_t
...@@ -13055,7 +13056,8 @@ innobase_rename_table( ...@@ -13055,7 +13056,8 @@ innobase_rename_table(
trx_t* trx, trx_t* trx,
const char* from, const char* from,
const char* to, const char* to,
bool commit = true) bool commit,
bool use_fk)
{ {
dberr_t error; dberr_t error;
char norm_to[FN_REFLEN]; char norm_to[FN_REFLEN];
...@@ -13110,7 +13112,8 @@ innobase_rename_table( ...@@ -13110,7 +13112,8 @@ innobase_rename_table(
goto func_exit; goto func_exit;
} }
error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit); error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit,
use_fk);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND if (error == DB_TABLE_NOT_FOUND
...@@ -13135,7 +13138,8 @@ innobase_rename_table( ...@@ -13135,7 +13138,8 @@ innobase_rename_table(
#endif /* _WIN32 */ #endif /* _WIN32 */
trx_start_if_not_started(trx, true); trx_start_if_not_started(trx, true);
error = row_rename_table_for_mysql( error = row_rename_table_for_mysql(
par_case_name, norm_to, trx, TRUE); par_case_name, norm_to, trx,
true, false);
} }
} }
...@@ -13216,7 +13220,8 @@ int ha_innobase::truncate() ...@@ -13216,7 +13220,8 @@ int ha_innobase::truncate()
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE); trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
int err = convert_error_code_to_mysql( int err = convert_error_code_to_mysql(
innobase_rename_table(trx, ib_table->name.m_name, temp_name, false), innobase_rename_table(trx, ib_table->name.m_name, temp_name,
false, false),
ib_table->flags, m_user_thd); ib_table->flags, m_user_thd);
if (err) { if (err) {
trx_rollback_for_mysql(trx); trx_rollback_for_mysql(trx);
...@@ -13269,7 +13274,7 @@ ha_innobase::rename_table( ...@@ -13269,7 +13274,7 @@ ha_innobase::rename_table(
++trx->will_lock; ++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX); trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
dberr_t error = innobase_rename_table(trx, from, to); dberr_t error = innobase_rename_table(trx, from, to, true, true);
DEBUG_SYNC(thd, "after_innobase_rename_table"); DEBUG_SYNC(thd, "after_innobase_rename_table");
......
...@@ -483,7 +483,9 @@ row_rename_table_for_mysql( ...@@ -483,7 +483,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */ const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */ const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */ trx_t* trx, /*!< in/out: transaction */
bool commit) /*!< in: whether to commit trx */ bool commit, /*!< in: whether to commit trx */
bool use_fk) /*!< in: whether to parse and enforce
FOREIGN KEY constraints */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//** /*********************************************************************//**
......
...@@ -3519,7 +3519,8 @@ row_drop_table_for_mysql( ...@@ -3519,7 +3519,8 @@ row_drop_table_for_mysql(
ib::info() << "Deferring DROP TABLE " << table->name ib::info() << "Deferring DROP TABLE " << table->name
<< "; renaming to " << tmp_name; << "; renaming to " << tmp_name;
err = row_rename_table_for_mysql( err = row_rename_table_for_mysql(
table->name.m_name, tmp_name, trx, false); table->name.m_name, tmp_name, trx,
false, false);
} else { } else {
err = DB_SUCCESS; err = DB_SUCCESS;
} }
...@@ -4144,7 +4145,9 @@ row_rename_table_for_mysql( ...@@ -4144,7 +4145,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */ const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */ const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */ trx_t* trx, /*!< in/out: transaction */
bool commit) /*!< in: whether to commit trx */ bool commit, /*!< in: whether to commit trx */
bool use_fk) /*!< in: whether to parse and enforce
FOREIGN KEY constraints */
{ {
dict_table_t* table = NULL; dict_table_t* table = NULL;
ibool dict_locked = FALSE; ibool dict_locked = FALSE;
...@@ -4248,7 +4251,7 @@ row_rename_table_for_mysql( ...@@ -4248,7 +4251,7 @@ row_rename_table_for_mysql(
goto funct_exit; goto funct_exit;
} else if (!old_is_tmp && new_is_tmp) { } else if (use_fk && !old_is_tmp && new_is_tmp) {
/* MySQL is doing an ALTER TABLE command and it renames the /* MySQL is doing an ALTER TABLE command and it renames the
original table to a temporary table name. We want to preserve original table to a temporary table name. We want to preserve
the original foreign key constraint definitions despite the the original foreign key constraint definitions despite the
......
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