Skip to content

Commit 0c30f1e

Browse files
author
Shaohua Wang
committed
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 <[email protected]> RB: 13414
1 parent 4df55db commit 0c30f1e

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
@@ -2676,6 +2676,10 @@ row_drop_tables_for_mysql_in_background(void)
26762676
return(n_tables + n_tables_dropped);
26772677
}
26782678

2679+
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
2680+
os_thread_sleep(5000000);
2681+
);
2682+
26792683
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
26802684
DICT_ERR_IGNORE_NONE);
26812685

@@ -2686,6 +2690,16 @@ row_drop_tables_for_mysql_in_background(void)
26862690
goto already_dropped;
26872691
}
26882692

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+
26892703
ut_a(!table->can_be_evicted);
26902704

26912705
dict_table_close(table, FALSE, FALSE);
@@ -3945,6 +3959,13 @@ row_drop_table_for_mysql(
39453959
}
39463960
}
39473961

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+
39483969
/* TODO: could we replace the counter n_foreign_key_checks_running
39493970
with lock checks on the table? Acquire here an exclusive lock on the
39503971
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that

0 commit comments

Comments
 (0)