Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 49b37df

Browse files
jainprfacebook-github-bot
authored andcommitted
Add wait event for create/drop tables flush
Summary: Similar to notifying thread scheduler of wait before performing a fsync in mysys, adding a thd wait event while creating/deleting a table. Differential Revision: D57388930 fbshipit-source-id: 1b5ae2f
1 parent b4894b0 commit 49b37df

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎include/mysql/service_thd_wait.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ typedef enum _thd_wait_type_e {
141141
*/
142142
THD_WAIT_RAFT_YIELD = 20,
143143

144-
THD_WAIT_LAST = 21,
144+
/**
145+
Used for create/delete table.
146+
*/
147+
THD_WAIT_TABLE_FLUSH_SYNC = 21,
148+
149+
THD_WAIT_LAST = 22,
145150
} thd_wait_type;
146151

147152
extern "C" struct thd_wait_service_st {

‎storage/innobase/fil/fil0fil.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4498,6 +4498,7 @@ dberr_t Fil_shard::space_delete(space_id_t space_id, buf_remove_t buf_remove) {
44984498
ut_ad(!fsp_is_system_tablespace(space_id));
44994499
ut_ad(!fsp_is_global_temporary(space_id));
45004500

4501+
Thd_wait_scope wait_scope(nullptr, THD_WAIT_TABLE_FLUSH_SYNC);
45014502
dberr_t err = wait_for_pending_operations(space_id, space, &path);
45024503

45034504
if (err != DB_SUCCESS) {
@@ -5637,6 +5638,7 @@ static dberr_t fil_create_tablespace(space_id_t space_id, const char *name,
56375638
ut_a(fsp_flags_is_valid(flags));
56385639
ut_a(type == FIL_TYPE_TEMPORARY || type == FIL_TYPE_TABLESPACE);
56395640

5641+
Thd_wait_scope wait_scope(nullptr, THD_WAIT_TABLE_FLUSH_SYNC);
56405642
bool has_shared_space = FSP_FLAGS_GET_SHARED(flags);
56415643
/* Create the subdirectories in the path, if they are
56425644
not there already. */
@@ -6531,6 +6533,7 @@ bool Fil_shard::space_extend(fil_space_t *space, page_no_t size) {
65316533
page_no_t prev_size = 0;
65326534
#endif /* UNIV_HOTBACKUP */
65336535

6536+
Thd_wait_scope wait_scope(nullptr, THD_WAIT_TABLE_FLUSH_SYNC);
65346537
for (;;) {
65356538
mutex_acquire();
65366539
space = get_space_by_id(space->id);

0 commit comments

Comments
 (0)