Commit 29df1003 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-20184 data race at global counter btr_cur_n_non_sea

Make all accesses to btr_cur_n_non_sea atomic.
parent 7db99932
...@@ -1292,7 +1292,7 @@ btr_cur_search_to_nth_level_func( ...@@ -1292,7 +1292,7 @@ btr_cur_search_to_nth_level_func(
} }
# endif /* BTR_CUR_HASH_ADAPT */ # endif /* BTR_CUR_HASH_ADAPT */
#endif /* BTR_CUR_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 /* If the hash search did not succeed, do binary search down the
tree */ tree */
......
...@@ -2052,7 +2052,7 @@ srv_mon_process_existing_counter( ...@@ -2052,7 +2052,7 @@ srv_mon_process_existing_counter(
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE: case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE:
value = btr_cur_n_non_sea; value = my_atomic_loadlint(&btr_cur_n_non_sea);
break; break;
case MONITOR_OVLD_PAGE_COMPRESS_SAVED: case MONITOR_OVLD_PAGE_COMPRESS_SAVED:
......
...@@ -1150,7 +1150,7 @@ srv_refresh_innodb_monitor_stats(void) ...@@ -1150,7 +1150,7 @@ srv_refresh_innodb_monitor_stats(void)
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
btr_cur_n_sea_old = btr_cur_n_sea; btr_cur_n_sea_old = btr_cur_n_sea;
#endif /* BTR_CUR_HASH_ADAPT */ #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(); log_refresh_stats();
...@@ -1309,16 +1309,16 @@ srv_printf_innodb_monitor( ...@@ -1309,16 +1309,16 @@ srv_printf_innodb_monitor(
"%.2f hash searches/s, %.2f non-hash searches/s\n", "%.2f hash searches/s, %.2f non-hash searches/s\n",
(btr_cur_n_sea - btr_cur_n_sea_old) (btr_cur_n_sea - btr_cur_n_sea_old)
/ time_elapsed, / 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); / time_elapsed);
btr_cur_n_sea_old = btr_cur_n_sea; btr_cur_n_sea_old = btr_cur_n_sea;
#else /* BTR_CUR_HASH_ADAPT */ #else /* BTR_CUR_HASH_ADAPT */
fprintf(file, fprintf(file,
"%.2f non-hash searches/s\n", "%.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); / time_elapsed);
#endif /* BTR_CUR_HASH_ADAPT */ #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" fputs("---\n"
"LOG\n" "LOG\n"
......
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