MDEV-35854: Clarify row_rename_table_for_mysql()

enum rename_fk: Replaces the "bool use_fk" parameter of
row_rename_table_for_mysql() and innobase_rename_table():

RENAME_IGNORE_FK: Replaces use_fk=false when the operation cannot
involve any FOREIGN KEY constraints, that is, it is a partitioned
table or an internal table for FULLTEXT INDEX.

RENAME_REBUILD: Replaces use_fk=false when the table may contain
FOREIGN KEY constraints, which must not be modified in the data
dictionary tables SYS_FOREIGN and SYS_FOREIGN_COLS.

RENAME_ALTER_COPY: Replaces use_fk=true. This is only specified
in ha_innobase::rename_table(), which may be invoked as part of
ALTER TABLE…ALGORITHM=COPY, but also during RENAME TABLE.

An alternative value RENAME_FK could be useful to specify in
ha_innobase::rename_table() when it is executed as part of
CREATE OR REPLACE TABLE, which currently is not an atomic operation.

Reviewed by: Debarun Banerjee
This commit is contained in:
Marko Mäkelä 2025-01-23 14:38:35 +02:00
commit 2543be6942
5 changed files with 33 additions and 18 deletions

View file

@ -10414,10 +10414,12 @@ commit_try_rebuild(
char* old_name= mem_heap_strdup(ctx->heap, user_table->name.m_name);
dberr_t error = row_rename_table_for_mysql(user_table->name.m_name,
ctx->tmp_name, trx, false);
ctx->tmp_name, trx,
RENAME_REBUILD);
if (error == DB_SUCCESS) {
error = row_rename_table_for_mysql(
rebuilt_table->name.m_name, old_name, trx, false);
rebuilt_table->name.m_name, old_name, trx,
RENAME_REBUILD);
if (error == DB_SUCCESS) {
/* The statistics for the surviving indexes will be
re-inserted in alter_stats_rebuild(). */