summaryrefslogtreecommitdiff
path: root/sql/sql_rename.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-03-30 17:06:55 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:13 +0200
commit83e529eced51aa965805e894349bbadd26881f3f (patch)
tree2f13b79cf5648498ee709424ea37105be730fcf3 /sql/sql_rename.cc
parent496a14e18714ac3f0b686ec5f57bf88e96512d2f (diff)
downloadmariadb-git-83e529eced51aa965805e894349bbadd26881f3f.tar.gz
MDEV-18465 Logging of DDL statements during backup
Many of the changes was needed to be able to collect and print engine name and table version id's in the ddl log.
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r--sql/sql_rename.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 205c3ce91b7..094578874a8 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -234,6 +234,7 @@ do_rename_temporary(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table)
struct rename_param
{
LEX_CSTRING old_alias, new_alias;
+ LEX_CUSTRING old_version;
handlerton *from_table_hton;
};
@@ -281,6 +282,7 @@ check_rename(THD *thd, rename_param *param,
DBUG_ASSERT(param->new_alias.str);
if (!ha_table_exists(thd, &ren_table->db, &param->old_alias,
+ &param->old_version, NULL,
&param->from_table_hton) ||
!param->from_table_hton)
{
@@ -301,7 +303,7 @@ check_rename(THD *thd, rename_param *param,
DBUG_RETURN(-1);
}
- if (ha_table_exists(thd, new_db, &param->new_alias, 0))
+ if (ha_table_exists(thd, new_db, &param->new_alias, NULL, NULL, 0))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), param->new_alias.str);
DBUG_RETURN(1); // This can't be skipped
@@ -379,7 +381,7 @@ do_rename(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state,
debug_crash_here("ddl_log_rename_before_rename_table");
if (!(rc= mysql_rename_table(hton, &ren_table->db, old_alias,
- new_db, new_alias, 0)))
+ new_db, new_alias, &param->old_version, 0)))
{
/* Table rename succeded.
It's safe to start recovery at rename trigger phase
@@ -413,7 +415,8 @@ do_rename(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state,
*/
debug_crash_here("ddl_log_rename_after_failed_rename_trigger");
(void) mysql_rename_table(hton, new_db, new_alias,
- &ren_table->db, old_alias, NO_FK_CHECKS);
+ &ren_table->db, old_alias, &param->old_version,
+ NO_FK_CHECKS);
debug_crash_here("ddl_log_rename_after_revert_rename_table");
ddl_log_disable_entry(ddl_log_state);
debug_crash_here("ddl_log_rename_after_disable_entry");