Skip to content

Commit 8b76df5

Browse files
committed
Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY REFERENCES IS
SLOW/CRASHES SEMAPHORE Second follow on push. This is to fix a use of uninitialized variable (identified by compilation failure of optimized build). approved by Sunny over IM.
1 parent 5a5e2b6 commit 8b76df5

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

storage/innobase/row/row0mysql.cc

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,6 @@ row_truncate_table_for_mysql(
31763176
dict_table_t* table, /*!< in: table handle */
31773177
trx_t* trx) /*!< in: transaction handle */
31783178
{
3179-
dict_foreign_t* foreign;
31803179
dberr_t err;
31813180
mem_heap_t* heap;
31823181
byte* buf;
@@ -3268,24 +3267,17 @@ row_truncate_table_for_mysql(
32683267
/* Check if the table is referenced by foreign key constraints from
32693268
some other table (not the table itself) */
32703269

3271-
bool found = false;
3272-
for (dict_foreign_set::iterator it = table->referenced_set.begin();
3273-
it != table->referenced_set.end();
3274-
++it) {
3275-
3276-
foreign = *it;
3277-
3278-
if (foreign->foreign_table != table) {
3279-
found = true;
3280-
break;
3281-
}
3282-
}
3270+
dict_foreign_set::iterator it
3271+
= std::find_if(table->referenced_set.begin(),
3272+
table->referenced_set.end(),
3273+
dict_foreign_different_tables());
32833274

32843275
if (!srv_read_only_mode
3285-
&& found
3276+
&& it != table->referenced_set.end()
32863277
&& trx->check_foreigns) {
32873278

3288-
FILE* ef = dict_foreign_err_file;
3279+
FILE* ef = dict_foreign_err_file;
3280+
dict_foreign_t* foreign = *it;
32893281

32903282
/* We only allow truncating a referenced table if
32913283
FOREIGN_KEY_CHECKS is set to 0 */

0 commit comments

Comments
 (0)