diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 41c53e252cc..3a8bc05f075 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -8282,7 +8282,9 @@ err_exit: num_of_idx); if (error == DB_SUCCESS && new_primary) { - row_merge_mark_prebuilt_obsolete(trx, innodb_table); + row_mysql_lock_data_dictionary(trx); + row_prebuilt_table_obsolete(innodb_table); + row_mysql_unlock_data_dictionary(trx); } } @@ -8625,10 +8627,6 @@ ha_innobase::final_drop_index( log_buffer_flush_to_disk(); -#ifdef UNIV_DEBUG_INDEX_CREATE - row_merge_print_table(prebuilt->table); -#endif - /* Tell the InnoDB server that there might be work for utility threads: */ diff --git a/include/row0merge.h b/include/row0merge.h index 89d6e21378e..a8b0a28af28 100644 --- a/include/row0merge.h +++ b/include/row0merge.h @@ -125,23 +125,6 @@ row_merge_file_create( merge_file_t* merge_file); /* out: merge file structure */ /************************************************************************* -Print definition of a table in the dictionary */ - -void -row_merge_print_table( -/*==================*/ - dict_table_t* table); /* in: table */ -/************************************************************************* -Mark all prebuilts using the table obsolete. These prebuilts are -rebuilded later. */ - -void -row_merge_mark_prebuilt_obsolete( -/*=============================*/ - - trx_t* trx, /* in: trx */ - dict_table_t* table); /* in: table */ -/************************************************************************* Create a temporary table using a definition of the old table. You must lock data dictionary before calling this function. */ diff --git a/include/row0mysql.h b/include/row0mysql.h index 453b1b2c213..9513607f548 100644 --- a/include/row0mysql.h +++ b/include/row0mysql.h @@ -162,6 +162,14 @@ row_update_prebuilt( row_prebuilt_t* prebuilt, /* in: Innobase table handle */ dict_table_t* table); /* in: table */ /************************************************************************* +Mark all prebuilt structs that use a table obsolete. They will +be rebuilt later. */ + +void +row_prebuilt_table_obsolete( +/*========================*/ + dict_table_t* table); /* in: table */ +/************************************************************************* Unlocks an AUTO_INC type lock possibly reserved by trx. */ void diff --git a/row/row0merge.c b/row/row0merge.c index 7ec59bb970e..3a2c4e321a1 100644 --- a/row/row0merge.c +++ b/row/row0merge.c @@ -1839,50 +1839,6 @@ row_merge_file_create( merge_file->num_of_blocks = 0; } -#ifdef UNIV_DEBUG_INDEX_CREATE -/************************************************************************* -Print definition of a table in the dictionary */ - -void -row_merge_print_table( -/*==================*/ - dict_table_t* table) /* in: table */ -{ - dict_table_print(table); -} -#endif - -/************************************************************************* -Mark all prebuilts using the table obsolete. These prebuilts are -rebuilt later. */ - -void -row_merge_mark_prebuilt_obsolete( -/*=============================*/ - - trx_t* trx, /* in: trx */ - dict_table_t* table) /* in: table */ -{ - row_prebuilt_t* prebuilt; - - row_mysql_lock_data_dictionary(trx); - - prebuilt = UT_LIST_GET_FIRST(table->prebuilts); - - while (prebuilt) { - prebuilt->magic_n = ROW_PREBUILT_OBSOLETE; - prebuilt->magic_n2 = ROW_PREBUILT_OBSOLETE; - - prebuilt = UT_LIST_GET_NEXT(prebuilts, prebuilt); - } - - /* This table will be dropped when there are no more references - to it */ - table->to_be_dropped = 1; - - row_mysql_unlock_data_dictionary(trx); -} - /************************************************************************* Create a temporary table using a definition of the old table. You must lock data dictionary before calling this function. */ diff --git a/row/row0mysql.c b/row/row0mysql.c index 3f106032e25..ea1c365e64e 100644 --- a/row/row0mysql.c +++ b/row/row0mysql.c @@ -809,6 +809,36 @@ row_prebuilt_free( mem_heap_free(prebuilt->heap); } +/************************************************************************* +Mark all prebuilt structs that use a table obsolete. They will +be rebuilt later. */ + +void +row_prebuilt_table_obsolete( +/*========================*/ + dict_table_t* table) /* in: table */ +{ + row_prebuilt_t* prebuilt; + +#ifdef UNIV_SYNC_DEBUG + ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); +#endif /* UNIV_SYNC_DEBUG */ + ut_ad(mutex_own(&dict_sys->mutex)); + + prebuilt = UT_LIST_GET_FIRST(table->prebuilts); + + while (prebuilt) { + prebuilt->magic_n = ROW_PREBUILT_OBSOLETE; + prebuilt->magic_n2 = ROW_PREBUILT_OBSOLETE; + + prebuilt = UT_LIST_GET_NEXT(prebuilts, prebuilt); + } + + /* This table will be dropped when there are no more references + to it */ + table->to_be_dropped = 1; +} + /************************************************************************* Updates the transaction pointers in query graphs stored in the prebuilt struct. */