@@ -2715,6 +2715,10 @@ row_drop_tables_for_mysql_in_background(void)
2715
2715
return (n_tables + n_tables_dropped);
2716
2716
}
2717
2717
2718
+ DBUG_EXECUTE_IF (" row_drop_tables_in_background_sleep" ,
2719
+ os_thread_sleep (5000000 );
2720
+ );
2721
+
2718
2722
table = dict_table_open_on_name (drop->table_name , FALSE , FALSE ,
2719
2723
DICT_ERR_IGNORE_NONE);
2720
2724
@@ -2725,6 +2729,16 @@ row_drop_tables_for_mysql_in_background(void)
2725
2729
goto already_dropped;
2726
2730
}
2727
2731
2732
+ if (!table->to_be_dropped ) {
2733
+ /* There is a scenario: the old table is dropped
2734
+ just after it's added into drop list, and new
2735
+ table with the same name is created, then we try
2736
+ to drop the new table in background. */
2737
+ dict_table_close (table, FALSE , FALSE );
2738
+
2739
+ goto already_dropped;
2740
+ }
2741
+
2728
2742
ut_a (!table->can_be_evicted );
2729
2743
2730
2744
dict_table_close (table, FALSE , FALSE );
@@ -3992,6 +4006,13 @@ row_drop_table_for_mysql(
3992
4006
}
3993
4007
}
3994
4008
4009
+
4010
+ DBUG_EXECUTE_IF (" row_drop_table_add_to_background" ,
4011
+ row_add_table_to_background_drop_list (table->name );
4012
+ err = DB_SUCCESS;
4013
+ goto funct_exit;
4014
+ );
4015
+
3995
4016
/* TODO: could we replace the counter n_foreign_key_checks_running
3996
4017
with lock checks on the table? Acquire here an exclusive lock on the
3997
4018
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that
@@ -4608,6 +4629,19 @@ row_drop_database_for_mysql(
4608
4629
row_mysql_lock_data_dictionary (trx);
4609
4630
4610
4631
while ((table_name = dict_get_first_table_name_in_db (name))) {
4632
+ /* Drop parent table if it is a fts aux table, to
4633
+ avoid accessing dropped fts aux tables in information
4634
+ scheam when parent table still exists.
4635
+ Note: Drop parent table will drop fts aux tables. */
4636
+ char * parent_table_name;
4637
+ parent_table_name = fts_get_parent_table_name (
4638
+ table_name, strlen (table_name));
4639
+
4640
+ if (parent_table_name != NULL ) {
4641
+ mem_free (table_name);
4642
+ table_name = parent_table_name;
4643
+ }
4644
+
4611
4645
ut_a (memcmp (table_name, name, namelen) == 0 );
4612
4646
4613
4647
table = dict_table_open_on_name (
0 commit comments