Skip to content

Commit

Permalink
MDEV-18582: Fix a race condition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Feb 6, 2020
1 parent 6d21441 commit cd3bdc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions storage/innobase/srv/srv0srv.cc
Expand Up @@ -1156,6 +1156,7 @@ srv_export_innodb_status(void)
ulint mem_adaptive_hash = 0;
ut_ad(btr_search_sys->hash_tables);
for (ulong i = 0; i < btr_ahi_parts; i++) {
rw_lock_s_lock(btr_search_latches[i]);
hash_table_t* ht = btr_search_sys->hash_tables[i];

ut_ad(ht);
Expand All @@ -1167,6 +1168,7 @@ srv_export_innodb_status(void)

mem_adaptive_hash += mem_heap_get_size(ht->heap)
+ ht->n_cells * sizeof(hash_cell_t);
rw_lock_s_unlock(btr_search_latches[i]);
}
export_vars.innodb_mem_adaptive_hash = mem_adaptive_hash;
#endif
Expand Down

0 comments on commit cd3bdc0

Please sign in to comment.