1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

10.0-base merge.

Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
This commit is contained in:
Sergei Golubchik
2013-09-21 10:14:42 +02:00
3463 changed files with 1907099 additions and 85423 deletions

View File

@ -4757,6 +4757,7 @@ make_unique_key_name(const char *field_name,KEY *start,KEY *end)
NO_FRM_RENAME Don't rename the FRM file
but only the table in the storage engine.
NO_HA_TABLE Don't rename table in engine.
NO_FK_CHECKS Don't check FK constraints during rename.
@return false OK
@return true Error
@ -4774,11 +4775,16 @@ mysql_rename_table(handlerton *base, const char *old_db,
char tmp_name[SAFE_NAME_LEN+1];
handler *file;
int error=0;
ulonglong save_bits= thd->variables.option_bits;
int length;
DBUG_ENTER("mysql_rename_table");
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db, old_name, new_db, new_name));
// Temporarily disable foreign key checks
if (flags & NO_FK_CHECKS)
thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
file= (base == NULL ? 0 :
get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
@ -4853,6 +4859,9 @@ mysql_rename_table(handlerton *base, const char *old_db,
old_name, strlen(old_name));
}
// Restore options bits to the original value
thd->variables.option_bits= save_bits;
DBUG_RETURN(error != 0);
}
@ -6518,7 +6527,7 @@ static bool mysql_inplace_alter_table(THD *thd,
*/
(void) mysql_rename_table(db_type,
alter_ctx->new_db, alter_ctx->new_alias,
alter_ctx->db, alter_ctx->alias, 0);
alter_ctx->db, alter_ctx->alias, NO_FK_CHECKS);
DBUG_RETURN(true);
}
rename_table_in_stat_tables(thd, alter_ctx->db,alter_ctx->alias,
@ -7499,7 +7508,8 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
{
(void) mysql_rename_table(old_db_type,
alter_ctx->new_db, alter_ctx->new_alias,
alter_ctx->db, alter_ctx->table_name, 0);
alter_ctx->db, alter_ctx->table_name,
NO_FK_CHECKS);
error= -1;
}
}
@ -8396,9 +8406,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
// Rename failed, delete the temporary table.
(void) quick_rm_table(thd, new_db_type, alter_ctx.new_db,
alter_ctx.tmp_name, FN_IS_TMP);
// Restore the backup of the original table to the old name.
(void) mysql_rename_table(old_db_type, alter_ctx.db, backup_name,
alter_ctx.db, alter_ctx.alias, FN_FROM_IS_TMP);
alter_ctx.db, alter_ctx.alias,
FN_FROM_IS_TMP | NO_FK_CHECKS);
goto err_with_mdl;
}
@ -8417,7 +8429,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
alter_ctx.new_db, alter_ctx.new_alias, 0);
// Restore the backup of the original table to the old name.
(void) mysql_rename_table(old_db_type, alter_ctx.db, backup_name,
alter_ctx.db, alter_ctx.alias, FN_FROM_IS_TMP);
alter_ctx.db, alter_ctx.alias,
FN_FROM_IS_TMP | NO_FK_CHECKS);
goto err_with_mdl;
}
rename_table_in_stat_tables(thd, alter_ctx.db,alter_ctx.alias,
@ -8795,6 +8808,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
{
/* Not a duplicate key error. */
to->file->print_error(error, MYF(0));
error= 1;
break;
}
else