@@ -7428,27 +7428,23 @@ innobase_drop_foreign_try(
7428
7428
}
7429
7429
7430
7430
/* * Rename a column in the data dictionary tables.
7431
- @param[in] user_table InnoDB table that was being altered
7432
- @param[in] trx Data dictionary transaction
7431
+ @param[in] ctx ALTER TABLE context
7432
+ @param[in,out ] trx Data dictionary transaction
7433
7433
@param[in] table_name Table name in MySQL
7434
7434
@param[in] nth_col 0-based index of the column
7435
7435
@param[in] from old column name
7436
7436
@param[in] to new column name
7437
- @param[in] new_clustered whether the table has been rebuilt
7438
- @param[in] evict_fk_cache Evict the fk info from cache
7439
7437
@retval true Failure
7440
7438
@retval false Success */
7441
7439
static MY_ATTRIBUTE ((nonnull, warn_unused_result))
7442
7440
bool
7443
7441
innobase_rename_column_try(
7444
- const dict_table_t * user_table,
7445
- trx_t * trx,
7446
- const char * table_name,
7447
- ulint nth_col,
7448
- const char * from,
7449
- const char * to,
7450
- bool new_clustered,
7451
- bool evict_fk_cache)
7442
+ const ha_innobase_inplace_ctx& ctx,
7443
+ trx_t * trx,
7444
+ const char * table_name,
7445
+ ulint nth_col,
7446
+ const char * from,
7447
+ const char * to)
7452
7448
{
7453
7449
pars_info_t * info;
7454
7450
dberr_t error;
@@ -7460,13 +7456,13 @@ innobase_rename_column_try(
7460
7456
ut_ad (mutex_own (&dict_sys->mutex ));
7461
7457
ut_ad (rw_lock_own (&dict_operation_lock, RW_LOCK_X));
7462
7458
7463
- if (new_clustered ) {
7459
+ if (ctx. need_rebuild () ) {
7464
7460
goto rename_foreign;
7465
7461
}
7466
7462
7467
7463
info = pars_info_create ();
7468
7464
7469
- pars_info_add_ull_literal (info, " tableid" , user_table ->id );
7465
+ pars_info_add_ull_literal (info, " tableid" , ctx. old_table ->id );
7470
7466
pars_info_add_int4_literal (info, " nth" , nth_col);
7471
7467
pars_info_add_str_literal (info, " new" , to);
7472
7468
@@ -7496,7 +7492,7 @@ innobase_rename_column_try(
7496
7492
trx->op_info = " renaming column in SYS_FIELDS" ;
7497
7493
7498
7494
for (const dict_index_t * index = dict_table_get_first_index (
7499
- user_table );
7495
+ ctx. old_table );
7500
7496
index != NULL ;
7501
7497
index = dict_table_get_next_index (index)) {
7502
7498
@@ -7549,8 +7545,8 @@ innobase_rename_column_try(
7549
7545
std::set<dict_foreign_t *> fk_evict;
7550
7546
bool foreign_modified;
7551
7547
7552
- for (dict_foreign_set::const_iterator it = user_table ->foreign_set .begin ();
7553
- it != user_table ->foreign_set .end ();
7548
+ for (dict_foreign_set::const_iterator it = ctx. old_table ->foreign_set .begin ();
7549
+ it != ctx. old_table ->foreign_set .end ();
7554
7550
++it) {
7555
7551
7556
7552
dict_foreign_t * foreign = *it;
@@ -7563,6 +7559,14 @@ innobase_rename_column_try(
7563
7559
continue ;
7564
7560
}
7565
7561
7562
+ /* Ignore the foreign key rename if fk info
7563
+ is being dropped. */
7564
+ if (innobase_dropping_foreign (
7565
+ foreign, ctx.drop_fk ,
7566
+ ctx.num_to_drop_fk )) {
7567
+ continue ;
7568
+ }
7569
+
7566
7570
info = pars_info_create ();
7567
7571
7568
7572
pars_info_add_str_literal (info, " id" , foreign->id );
@@ -7591,8 +7595,8 @@ innobase_rename_column_try(
7591
7595
}
7592
7596
7593
7597
for (dict_foreign_set::const_iterator it
7594
- = user_table ->referenced_set .begin ();
7595
- it != user_table ->referenced_set .end ();
7598
+ = ctx. old_table ->referenced_set .begin ();
7599
+ it != ctx. old_table ->referenced_set .end ();
7596
7600
++it) {
7597
7601
7598
7602
foreign_modified = false ;
@@ -7633,7 +7637,7 @@ innobase_rename_column_try(
7633
7637
}
7634
7638
7635
7639
/* Reload the foreign key info for instant table too. */
7636
- if (new_clustered || evict_fk_cache ) {
7640
+ if (ctx. need_rebuild () || ctx. is_instant () ) {
7637
7641
std::for_each (fk_evict.begin (), fk_evict.end (),
7638
7642
dict_foreign_remove_from_cache);
7639
7643
}
@@ -7684,12 +7688,10 @@ innobase_rename_columns_try(
7684
7688
: i - num_v;
7685
7689
7686
7690
if (innobase_rename_column_try (
7687
- ctx-> old_table , trx, table_name,
7691
+ * ctx, trx, table_name,
7688
7692
col_n,
7689
7693
cf->field ->field_name .str ,
7690
- cf->field_name .str ,
7691
- ctx->need_rebuild (),
7692
- ctx->is_instant ())) {
7694
+ cf->field_name .str )) {
7693
7695
return (true );
7694
7696
}
7695
7697
goto processed_field;
0 commit comments