mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Revert MDEV-25292 Atomic CREATE OR REPLACE TABLE
Specifically: Revert "MDEV-29664 Assertion `!n_mysql_tables_in_use' failed in innobase_close_connection" This reverts commitba875e9396
. Revert "MDEV-29620 Assertion `next_insert_id == 0' failed in handler::ha_external_lock" This reverts commitaa08a7442a
. Revert "MDEV-29628 Memory leak after CREATE OR REPLACE with foreign key" This reverts commitc579d66ba6
. Revert "MDEV-29609 create_not_windows test fails with different result" This reverts commitcb583b2f1b
. Revert "MDEV-29544 SIGSEGV in HA_CREATE_INFO::finalize_locked_tables" This reverts commitdcd66c3814
. Revert "MDEV-28933 CREATE OR REPLACE fails to recreate same constraint name" This reverts commitcf6c517632
. Revert "MDEV-28933 Moved RENAME_CONSTRAINT_IDS to include/sql_funcs.h" This reverts commitf1e1c1335b
. Revert "MDEV-28956 Locking is broken if CREATE OR REPLACE fails under LOCK TABLES" This reverts commita228ec80e3
. Revert "MDEV-25292 gcol.gcol_bugfixes --ps fix" This reverts commit24fff8267d
. Revert "MDEV-25292 Disable atomic replace for slave-generated or-replace" This reverts commit2af15914cb
. Revert "MDEV-25292 backup_log improved" This reverts commit34398a20b5
. Revert "MDEV-25292 Atomic CREATE OR REPLACE TABLE" This reverts commit93c8252f02
. Revert "MDEV-25292 Table_name class for (db, table_name, alias)" This reverts commitd145dda9c7
. Revert "MDEV-25292 ha_table_exists() cleanup and improvement" This reverts commit409b8a86de
. Revert "MDEV-25292 Cleanups" This reverts commit595dad83ad
. Revert "MDEV-25292 Refactoring: moved select_field_count into Alter_info." This reverts commitf02af1d229
.
This commit is contained in:
@@ -1200,11 +1200,9 @@ bool Trigger::add_to_file_list(void* param_arg)
|
||||
*/
|
||||
|
||||
static bool rm_trigger_file(char *path, const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *table_name, uint flags,
|
||||
myf MyFlags)
|
||||
const LEX_CSTRING *table_name, myf MyFlags)
|
||||
{
|
||||
build_table_filename(path, FN_REFLEN - 1, db->str, table_name->str, TRG_EXT,
|
||||
flags);
|
||||
build_table_filename(path, FN_REFLEN-1, db->str, table_name->str, TRG_EXT, 0);
|
||||
return mysql_file_delete(key_file_trg, path, MyFlags);
|
||||
}
|
||||
|
||||
@@ -1246,8 +1244,7 @@ bool rm_trigname_file(char *path, const LEX_CSTRING *db,
|
||||
*/
|
||||
|
||||
bool Table_triggers_list::save_trigger_file(THD *thd, const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *table_name,
|
||||
uint flags)
|
||||
const LEX_CSTRING *table_name)
|
||||
{
|
||||
char file_buff[FN_REFLEN];
|
||||
LEX_CSTRING file;
|
||||
@@ -1257,7 +1254,7 @@ bool Table_triggers_list::save_trigger_file(THD *thd, const LEX_CSTRING *db,
|
||||
DBUG_RETURN(true);
|
||||
|
||||
file.length= build_table_filename(file_buff, FN_REFLEN - 1, db->str, table_name->str,
|
||||
TRG_EXT, flags);
|
||||
TRG_EXT, 0);
|
||||
file.str= file_buff;
|
||||
DBUG_RETURN(sql_create_definition_file(NULL, &file, &triggers_file_type,
|
||||
(uchar*) this,
|
||||
@@ -1367,12 +1364,12 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables,
|
||||
drop or create ddl_log recovery will ensure that all related
|
||||
trigger files are deleted or the original ones are restored.
|
||||
*/
|
||||
if (rm_trigger_file(path, &tables->db, &tables->table_name, 0, MYF(MY_WME)))
|
||||
if (rm_trigger_file(path, &tables->db, &tables->table_name, MYF(MY_WME)))
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (save_trigger_file(thd, &tables->db, &tables->table_name, 0))
|
||||
if (save_trigger_file(thd, &tables->db, &tables->table_name))
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1531,8 +1528,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
|
||||
bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *table_name,
|
||||
TABLE *table,
|
||||
bool names_only,
|
||||
uint flags)
|
||||
bool names_only)
|
||||
{
|
||||
char path_buff[FN_REFLEN];
|
||||
LEX_CSTRING path;
|
||||
@@ -1541,7 +1537,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
|
||||
DBUG_ENTER("Table_triggers_list::check_n_load");
|
||||
|
||||
path.length= build_table_filename(path_buff, FN_REFLEN - 1,
|
||||
db->str, table_name->str, TRG_EXT, flags);
|
||||
db->str, table_name->str, TRG_EXT, 0);
|
||||
path.str= path_buff;
|
||||
|
||||
// QQ: should we analyze errno somehow ?
|
||||
@@ -2038,7 +2034,7 @@ bool add_table_for_trigger(THD *thd,
|
||||
|
||||
bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *name,
|
||||
uint flags, myf MyFlags)
|
||||
myf MyFlags)
|
||||
{
|
||||
TABLE table;
|
||||
char path[FN_REFLEN];
|
||||
@@ -2049,11 +2045,11 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db,
|
||||
init_sql_alloc(key_memory_Table_trigger_dispatcher,
|
||||
&table.mem_root, 8192, 0, MYF(MY_WME));
|
||||
|
||||
if (Table_triggers_list::check_n_load(thd, db, name, &table, true, flags))
|
||||
if (Table_triggers_list::check_n_load(thd, db, name, &table, 1))
|
||||
{
|
||||
result= 1;
|
||||
/* We couldn't parse trigger file, best to just remove it */
|
||||
rm_trigger_file(path, db, name, flags, MyFlags);
|
||||
rm_trigger_file(path, db, name, MyFlags);
|
||||
goto end;
|
||||
}
|
||||
if (table.triggers)
|
||||
@@ -2087,7 +2083,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rm_trigger_file(path, db, name, flags, MyFlags))
|
||||
if (rm_trigger_file(path, db, name, MyFlags))
|
||||
result= 1;
|
||||
delete table.triggers;
|
||||
}
|
||||
@@ -2129,8 +2125,7 @@ change_table_name_in_triggers(THD *thd,
|
||||
const LEX_CSTRING *old_db_name,
|
||||
const LEX_CSTRING *new_db_name,
|
||||
const LEX_CSTRING *old_table_name,
|
||||
const LEX_CSTRING *new_table_name,
|
||||
uint flags)
|
||||
const LEX_CSTRING *new_table_name)
|
||||
{
|
||||
struct change_table_name_param param;
|
||||
sql_mode_t save_sql_mode= thd->variables.sql_mode;
|
||||
@@ -2146,15 +2141,13 @@ change_table_name_in_triggers(THD *thd,
|
||||
if (unlikely(thd->is_fatal_error))
|
||||
return TRUE; /* OOM */
|
||||
|
||||
if (save_trigger_file(thd, new_db_name, new_table_name,
|
||||
(flags & FN_TO_IS_TMP)))
|
||||
if (save_trigger_file(thd, new_db_name, new_table_name))
|
||||
return TRUE;
|
||||
|
||||
if (rm_trigger_file(path_buff, old_db_name, old_table_name,
|
||||
(flags & FN_FROM_IS_TMP), MYF(MY_WME)))
|
||||
if (rm_trigger_file(path_buff, old_db_name, old_table_name, MYF(MY_WME)))
|
||||
{
|
||||
(void) rm_trigger_file(path_buff, new_db_name, new_table_name,
|
||||
(flags & FN_TO_IS_TMP), MYF(MY_WME));
|
||||
MYF(MY_WME));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -2304,8 +2297,7 @@ Table_triggers_list::prepare_for_rename(THD *thd,
|
||||
my_strcasecmp(table_alias_charset, old_alias->str,
|
||||
new_table->str));
|
||||
|
||||
if (Table_triggers_list::check_n_load(thd, db, old_table, table, TRUE,
|
||||
param->rename_flags))
|
||||
if (Table_triggers_list::check_n_load(thd, db, old_table, table, TRUE))
|
||||
{
|
||||
result= 1;
|
||||
goto end;
|
||||
@@ -2392,17 +2384,15 @@ bool Table_triggers_list::change_table_name(THD *thd,
|
||||
This method interfaces the mysql server code protected by
|
||||
an exclusive metadata lock.
|
||||
*/
|
||||
DBUG_ASSERT((param->rename_flags & FN_FROM_IS_TMP) ||
|
||||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, db->str,
|
||||
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db->str,
|
||||
old_table->str,
|
||||
MDL_EXCLUSIVE));
|
||||
|
||||
if (table->triggers)
|
||||
{
|
||||
if (unlikely(table->triggers->
|
||||
change_table_name_in_triggers(thd, db, new_db, old_alias,
|
||||
new_table,
|
||||
param->rename_flags)))
|
||||
if (unlikely(table->triggers->change_table_name_in_triggers(thd, db, new_db,
|
||||
old_alias,
|
||||
new_table)))
|
||||
{
|
||||
result= 1;
|
||||
goto end;
|
||||
@@ -2420,9 +2410,9 @@ bool Table_triggers_list::change_table_name(THD *thd,
|
||||
(void) table->triggers->change_table_name_in_trignames(
|
||||
upgrading50to51 ? new_db : NULL, db,
|
||||
old_alias, err_trigger);
|
||||
(void) table->triggers->
|
||||
change_table_name_in_triggers(thd, db, new_db, new_table, old_alias,
|
||||
(param->rename_flags ^ FN_IS_TMP));
|
||||
(void) table->triggers->change_table_name_in_triggers(
|
||||
thd, db, new_db,
|
||||
new_table, old_alias);
|
||||
result= 1;
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user