Skip to content

Commit cd3bdc0

Browse files
committed
MDEV-18582: Fix a race condition
srv_export_innodb_status(): While gathering innodb_mem_adaptive_hash, acquire btr_search_latches[i] in order to prevent a race condition with buffer pool resizing.
1 parent 6d21441 commit cd3bdc0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

storage/innobase/srv/srv0srv.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ srv_export_innodb_status(void)
11561156
ulint mem_adaptive_hash = 0;
11571157
ut_ad(btr_search_sys->hash_tables);
11581158
for (ulong i = 0; i < btr_ahi_parts; i++) {
1159+
rw_lock_s_lock(btr_search_latches[i]);
11591160
hash_table_t* ht = btr_search_sys->hash_tables[i];
11601161

11611162
ut_ad(ht);
@@ -1167,6 +1168,7 @@ srv_export_innodb_status(void)
11671168

11681169
mem_adaptive_hash += mem_heap_get_size(ht->heap)
11691170
+ ht->n_cells * sizeof(hash_cell_t);
1171+
rw_lock_s_unlock(btr_search_latches[i]);
11701172
}
11711173
export_vars.innodb_mem_adaptive_hash = mem_adaptive_hash;
11721174
#endif

0 commit comments

Comments
 (0)