Skip to content
Permalink
Browse files

MDEV-20184 data race at global counter btr_cur_n_non_sea

Make all accesses to btr_cur_n_non_sea atomic.
  • Loading branch information...
kevgs committed Jul 26, 2019
1 parent 7db9993 commit 29df1003d9faf09b635eedf10a0e3196e71bb297
Showing with 6 additions and 6 deletions.
  1. +1 −1 storage/innobase/btr/btr0cur.cc
  2. +1 −1 storage/innobase/srv/srv0mon.cc
  3. +4 −4 storage/innobase/srv/srv0srv.cc
@@ -1292,7 +1292,7 @@ btr_cur_search_to_nth_level_func(
}
# endif /* BTR_CUR_HASH_ADAPT */
#endif /* BTR_CUR_ADAPT */
btr_cur_n_non_sea++;
my_atomic_addlint(&btr_cur_n_non_sea, 1);

/* If the hash search did not succeed, do binary search down the
tree */
@@ -2052,7 +2052,7 @@ srv_mon_process_existing_counter(
#endif /* BTR_CUR_HASH_ADAPT */

case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE:
value = btr_cur_n_non_sea;
value = my_atomic_loadlint(&btr_cur_n_non_sea);
break;

case MONITOR_OVLD_PAGE_COMPRESS_SAVED:
@@ -1150,7 +1150,7 @@ srv_refresh_innodb_monitor_stats(void)
#ifdef BTR_CUR_HASH_ADAPT
btr_cur_n_sea_old = btr_cur_n_sea;
#endif /* BTR_CUR_HASH_ADAPT */
btr_cur_n_non_sea_old = btr_cur_n_non_sea;
btr_cur_n_non_sea_old = my_atomic_loadlint(&btr_cur_n_non_sea);

log_refresh_stats();

@@ -1309,16 +1309,16 @@ srv_printf_innodb_monitor(
"%.2f hash searches/s, %.2f non-hash searches/s\n",
(btr_cur_n_sea - btr_cur_n_sea_old)
/ time_elapsed,
(btr_cur_n_non_sea - btr_cur_n_non_sea_old)
(my_atomic_loadlint(&btr_cur_n_non_sea) - btr_cur_n_non_sea_old)
/ time_elapsed);
btr_cur_n_sea_old = btr_cur_n_sea;
#else /* BTR_CUR_HASH_ADAPT */
fprintf(file,
"%.2f non-hash searches/s\n",
(btr_cur_n_non_sea - btr_cur_n_non_sea_old)
(my_atomic_loadlint(&btr_cur_n_non_sea) - btr_cur_n_non_sea_old)
/ time_elapsed);
#endif /* BTR_CUR_HASH_ADAPT */
btr_cur_n_non_sea_old = btr_cur_n_non_sea;
btr_cur_n_non_sea_old = my_atomic_loadlint(&btr_cur_n_non_sea);

fputs("---\n"
"LOG\n"

0 comments on commit 29df100

Please sign in to comment.
You can’t perform that action at this time.