Skip to content

Commit b862c79

Browse files
Shaohua Wangdr-m
authored andcommitted
BUG#24315031 FAILING ASSERTION: !TABLE->CAN_BE_EVICTED
Analysis: the old table is dropped, just after it's added into drop list, and new table with the same name is created, then we try to drop the new table in background. Solution: Don't drop a table in background if table->to_be_dropped is false. Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com> RB: 13414
1 parent 9ce1ea6 commit b862c79

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

storage/innobase/row/row0mysql.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2888,6 +2888,10 @@ row_drop_tables_for_mysql_in_background(void)
28882888
return(n_tables + n_tables_dropped);
28892889
}
28902890

2891+
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
2892+
os_thread_sleep(5000000);
2893+
);
2894+
28912895
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
28922896
DICT_ERR_IGNORE_NONE);
28932897

@@ -2898,6 +2902,16 @@ row_drop_tables_for_mysql_in_background(void)
28982902
goto already_dropped;
28992903
}
29002904

2905+
if (!table->to_be_dropped) {
2906+
/* There is a scenario: the old table is dropped
2907+
just after it's added into drop list, and new
2908+
table with the same name is created, then we try
2909+
to drop the new table in background. */
2910+
dict_table_close(table, FALSE, FALSE);
2911+
2912+
goto already_dropped;
2913+
}
2914+
29012915
ut_a(!table->can_be_evicted);
29022916

29032917
dict_table_close(table, FALSE, FALSE);
@@ -3766,6 +3780,13 @@ row_drop_table_for_mysql(
37663780
}
37673781
}
37683782

3783+
3784+
DBUG_EXECUTE_IF("row_drop_table_add_to_background",
3785+
row_add_table_to_background_drop_list(table->name.m_name);
3786+
err = DB_SUCCESS;
3787+
goto funct_exit;
3788+
);
3789+
37693790
/* TODO: could we replace the counter n_foreign_key_checks_running
37703791
with lock checks on the table? Acquire here an exclusive lock on the
37713792
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that

0 commit comments

Comments
 (0)