Commit cd3bdc09 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 6d214415
...@@ -1156,6 +1156,7 @@ srv_export_innodb_status(void) ...@@ -1156,6 +1156,7 @@ srv_export_innodb_status(void)
ulint mem_adaptive_hash = 0; ulint mem_adaptive_hash = 0;
ut_ad(btr_search_sys->hash_tables); ut_ad(btr_search_sys->hash_tables);
for (ulong i = 0; i < btr_ahi_parts; i++) { 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]; hash_table_t* ht = btr_search_sys->hash_tables[i];
ut_ad(ht); ut_ad(ht);
...@@ -1167,6 +1168,7 @@ srv_export_innodb_status(void) ...@@ -1167,6 +1168,7 @@ srv_export_innodb_status(void)
mem_adaptive_hash += mem_heap_get_size(ht->heap) mem_adaptive_hash += mem_heap_get_size(ht->heap)
+ ht->n_cells * sizeof(hash_cell_t); + ht->n_cells * sizeof(hash_cell_t);
rw_lock_s_unlock(btr_search_latches[i]);
} }
export_vars.innodb_mem_adaptive_hash = mem_adaptive_hash; export_vars.innodb_mem_adaptive_hash = mem_adaptive_hash;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment