@@ -2676,6 +2676,10 @@ row_drop_tables_for_mysql_in_background(void)
2676
2676
return (n_tables + n_tables_dropped);
2677
2677
}
2678
2678
2679
+ DBUG_EXECUTE_IF (" row_drop_tables_in_background_sleep" ,
2680
+ os_thread_sleep (5000000 );
2681
+ );
2682
+
2679
2683
table = dict_table_open_on_name (drop->table_name , FALSE , FALSE ,
2680
2684
DICT_ERR_IGNORE_NONE);
2681
2685
@@ -2686,6 +2690,16 @@ row_drop_tables_for_mysql_in_background(void)
2686
2690
goto already_dropped;
2687
2691
}
2688
2692
2693
+ if (!table->to_be_dropped ) {
2694
+ /* There is a scenario: the old table is dropped
2695
+ just after it's added into drop list, and new
2696
+ table with the same name is created, then we try
2697
+ to drop the new table in background. */
2698
+ dict_table_close (table, FALSE , FALSE );
2699
+
2700
+ goto already_dropped;
2701
+ }
2702
+
2689
2703
ut_a (!table->can_be_evicted );
2690
2704
2691
2705
dict_table_close (table, FALSE , FALSE );
@@ -3945,6 +3959,13 @@ row_drop_table_for_mysql(
3945
3959
}
3946
3960
}
3947
3961
3962
+
3963
+ DBUG_EXECUTE_IF (" row_drop_table_add_to_background" ,
3964
+ row_add_table_to_background_drop_list (table->name );
3965
+ err = DB_SUCCESS;
3966
+ goto funct_exit;
3967
+ );
3968
+
3948
3969
/* TODO: could we replace the counter n_foreign_key_checks_running
3949
3970
with lock checks on the table? Acquire here an exclusive lock on the
3950
3971
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that
@@ -4561,6 +4582,19 @@ row_drop_database_for_mysql(
4561
4582
row_mysql_lock_data_dictionary (trx);
4562
4583
4563
4584
while ((table_name = dict_get_first_table_name_in_db (name))) {
4585
+ /* Drop parent table if it is a fts aux table, to
4586
+ avoid accessing dropped fts aux tables in information
4587
+ scheam when parent table still exists.
4588
+ Note: Drop parent table will drop fts aux tables. */
4589
+ char * parent_table_name;
4590
+ parent_table_name = fts_get_parent_table_name (
4591
+ table_name, strlen (table_name));
4592
+
4593
+ if (parent_table_name != NULL ) {
4594
+ mem_free (table_name);
4595
+ table_name = parent_table_name;
4596
+ }
4597
+
4564
4598
ut_a (memcmp (table_name, name, namelen) == 0 );
4565
4599
4566
4600
table = dict_table_open_on_name (
0 commit comments