mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -27,10 +27,8 @@
|
||||
|
||||
class Alter_info;
|
||||
class Alter_table_ctx;
|
||||
struct Atomic_info;
|
||||
class Column_definition;
|
||||
class Create_field;
|
||||
struct Table_name;
|
||||
struct TABLE_LIST;
|
||||
class THD;
|
||||
struct TABLE;
|
||||
@ -96,15 +94,50 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen);
|
||||
bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword,
|
||||
const LEX_CSTRING *add);
|
||||
|
||||
/*
|
||||
mysql_create_table_no_lock can be called in one of the following
|
||||
mutually exclusive situations:
|
||||
|
||||
- Just a normal ordinary CREATE TABLE statement that explicitly
|
||||
defines the table structure.
|
||||
|
||||
- CREATE TABLE ... SELECT. It is special, because only in this case,
|
||||
the list of fields is allowed to have duplicates, as long as one of the
|
||||
duplicates comes from the select list, and the other doesn't. For
|
||||
example in
|
||||
|
||||
CREATE TABLE t1 (a int(5) NOT NUL) SELECT b+10 as a FROM t2;
|
||||
|
||||
the list in alter_info->create_list will have two fields `a`.
|
||||
|
||||
- ALTER TABLE, that creates a temporary table #sql-xxx, which will be later
|
||||
renamed to replace the original table.
|
||||
|
||||
- ALTER TABLE as above, but which only modifies the frm file, it only
|
||||
creates an frm file for the #sql-xxx, the table in the engine is not
|
||||
created.
|
||||
|
||||
- Assisted discovery, CREATE TABLE statement without the table structure.
|
||||
|
||||
These situations are distinguished by the following "create table mode"
|
||||
values, where a CREATE ... SELECT is denoted by any non-negative number
|
||||
(which should be the number of fields in the SELECT ... part), and other
|
||||
cases use constants as defined below.
|
||||
*/
|
||||
#define C_CREATE_SELECT(X) ((X) > 0 ? (X) : 0)
|
||||
#define C_ORDINARY_CREATE 0
|
||||
#define C_ALTER_TABLE -1
|
||||
#define C_ALTER_TABLE_FRM_ONLY -2
|
||||
#define C_ASSISTED_DISCOVERY -3
|
||||
|
||||
int mysql_create_table_no_lock(THD *thd,
|
||||
const LEX_CSTRING *orig_db,
|
||||
const LEX_CSTRING *orig_table_name,
|
||||
DDL_LOG_STATE *ddl_log_state,
|
||||
DDL_LOG_STATE *ddl_log_state_rm,
|
||||
const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *table_name,
|
||||
Table_specification_st *create_info,
|
||||
Alter_info *alter_info, bool *is_trans,
|
||||
int create_table_mode, TABLE_LIST *table,
|
||||
LEX_CUSTRING *frm= NULL);
|
||||
int create_table_mode, TABLE_LIST *table);
|
||||
|
||||
handler *mysql_create_frm_image(THD *thd,
|
||||
const LEX_CSTRING &db,
|
||||
@ -138,31 +171,6 @@ bool mysql_compare_tables(TABLE *table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
bool *metadata_equal);
|
||||
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy);
|
||||
/**
|
||||
Parameters for rename_table_and_triggers()
|
||||
*/
|
||||
struct rename_param
|
||||
{
|
||||
LEX_CSTRING old_alias, new_alias;
|
||||
LEX_CUSTRING old_version;
|
||||
handlerton *from_table_hton;
|
||||
int rename_flags; /* FN_FROM_IS_TMP, FN_TO_IS_TMP, etc */
|
||||
rename_param() :
|
||||
from_table_hton(NULL),
|
||||
rename_flags(0) {}
|
||||
};
|
||||
bool
|
||||
rename_table_and_triggers(THD *thd, rename_param *param,
|
||||
DDL_LOG_STATE *ddl_log_state,
|
||||
Table_name *ren_table, const LEX_CSTRING *new_db,
|
||||
bool skip_error, bool *force_if_exists);
|
||||
int
|
||||
rename_check_preconditions(THD *thd, rename_param *param,
|
||||
Table_name *ren_table,
|
||||
const LEX_CSTRING *new_db,
|
||||
const LEX_CSTRING *new_table_name,
|
||||
const LEX_CSTRING *new_table_alias,
|
||||
bool if_exists);
|
||||
bool mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
|
||||
const LEX_CSTRING *old_name, const LEX_CSTRING *new_db,
|
||||
const LEX_CSTRING *new_name, LEX_CUSTRING *id,
|
||||
|
Reference in New Issue
Block a user