Commit fcb6bb4b authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents e5144f4b a7251634
...@@ -162,6 +162,7 @@ EOF ...@@ -162,6 +162,7 @@ EOF
wait wait
EOF EOF
START SLAVE; START SLAVE;
--error 0,2006,2013
SET GLOBAL debug_dbug="+d,crash_commit_before"; SET GLOBAL debug_dbug="+d,crash_commit_before";
--connection server_1 --connection server_1
......
...@@ -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);
} }
/****************************************************************//** /****************************************************************//**
...@@ -6193,7 +6193,7 @@ fts_rename_one_aux_table_to_hex_format( ...@@ -6193,7 +6193,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 '"
...@@ -6332,7 +6332,7 @@ fts_rename_aux_tables_to_hex_format_low( ...@@ -6332,7 +6332,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);
......
...@@ -13053,6 +13053,7 @@ innobase_drop_database( ...@@ -13053,6 +13053,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
...@@ -13060,7 +13061,8 @@ innobase_rename_table( ...@@ -13060,7 +13061,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];
...@@ -13115,7 +13117,8 @@ innobase_rename_table( ...@@ -13115,7 +13117,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
...@@ -13140,7 +13143,8 @@ innobase_rename_table( ...@@ -13140,7 +13143,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);
} }
} }
...@@ -13221,7 +13225,8 @@ int ha_innobase::truncate() ...@@ -13221,7 +13225,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);
...@@ -13274,7 +13279,7 @@ ha_innobase::rename_table( ...@@ -13274,7 +13279,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");
......
...@@ -5979,8 +5979,10 @@ prepare_inplace_alter_table_dict( ...@@ -5979,8 +5979,10 @@ prepare_inplace_alter_table_dict(
user_table, ctx->trx); user_table, ctx->trx);
if (ctx->need_rebuild()) { if (ctx->need_rebuild()) {
if (ctx->new_table) {
ut_ad(!ctx->new_table->cached); ut_ad(!ctx->new_table->cached);
dict_mem_table_free(ctx->new_table); dict_mem_table_free(ctx->new_table);
}
ctx->new_table = ctx->old_table; ctx->new_table = ctx->old_table;
} }
...@@ -6456,7 +6458,7 @@ prepare_inplace_alter_table_dict( ...@@ -6456,7 +6458,7 @@ prepare_inplace_alter_table_dict(
break; break;
case DB_TABLESPACE_EXISTS: case DB_TABLESPACE_EXISTS:
my_error(ER_TABLESPACE_EXISTS, MYF(0), my_error(ER_TABLESPACE_EXISTS, MYF(0),
ctx->new_table->name.m_name); altered_table->s->table_name.str);
goto new_table_failed; goto new_table_failed;
case DB_DUPLICATE_KEY: case DB_DUPLICATE_KEY:
my_error(HA_ERR_TABLE_EXIST, MYF(0), my_error(HA_ERR_TABLE_EXIST, MYF(0),
...@@ -6464,12 +6466,13 @@ prepare_inplace_alter_table_dict( ...@@ -6464,12 +6466,13 @@ prepare_inplace_alter_table_dict(
goto new_table_failed; goto new_table_failed;
case DB_UNSUPPORTED: case DB_UNSUPPORTED:
my_error(ER_UNSUPPORTED_EXTENSION, MYF(0), my_error(ER_UNSUPPORTED_EXTENSION, MYF(0),
ctx->new_table->name.m_name); altered_table->s->table_name.str);
goto new_table_failed; goto new_table_failed;
default: default:
my_error_innodb(error, table_name, flags); my_error_innodb(error, table_name, flags);
new_table_failed: new_table_failed:
DBUG_ASSERT(ctx->trx != ctx->prebuilt->trx); DBUG_ASSERT(ctx->trx != ctx->prebuilt->trx);
ctx->new_table = NULL;
goto new_clustered_failed; goto new_clustered_failed;
} }
......
...@@ -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));
/*********************************************************************//** /*********************************************************************//**
......
...@@ -3520,7 +3520,8 @@ row_drop_table_for_mysql( ...@@ -3520,7 +3520,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;
} }
...@@ -4145,7 +4146,9 @@ row_rename_table_for_mysql( ...@@ -4145,7 +4146,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;
...@@ -4249,7 +4252,7 @@ row_rename_table_for_mysql( ...@@ -4249,7 +4252,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