Commit 5a594244 authored by Jimmy Yang's avatar Jimmy Yang

Merge from mysql-5.1-innodb to mysql-5.5-innodb.

parents ee12afc0 662fb84a
...@@ -2076,6 +2076,7 @@ buf_LRU_stat_update(void) ...@@ -2076,6 +2076,7 @@ buf_LRU_stat_update(void)
buf_LRU_stat_t* item; buf_LRU_stat_t* item;
buf_pool_t* buf_pool; buf_pool_t* buf_pool;
ibool evict_started = FALSE; ibool evict_started = FALSE;
buf_LRU_stat_t cur_stat;
/* If we haven't started eviction yet then don't update stats. */ /* If we haven't started eviction yet then don't update stats. */
for (i = 0; i < srv_buf_pool_instances; i++) { for (i = 0; i < srv_buf_pool_instances; i++) {
...@@ -2097,12 +2098,19 @@ buf_LRU_stat_update(void) ...@@ -2097,12 +2098,19 @@ buf_LRU_stat_update(void)
buf_LRU_stat_arr_ind++; buf_LRU_stat_arr_ind++;
buf_LRU_stat_arr_ind %= BUF_LRU_STAT_N_INTERVAL; buf_LRU_stat_arr_ind %= BUF_LRU_STAT_N_INTERVAL;
/* Add the current value and subtract the obsolete entry. */ /* Add the current value and subtract the obsolete entry.
buf_LRU_stat_sum.io += buf_LRU_stat_cur.io - item->io; Since buf_LRU_stat_cur is not protected by any mutex,
buf_LRU_stat_sum.unzip += buf_LRU_stat_cur.unzip - item->unzip; it can be changing between adding to buf_LRU_stat_sum
and copying to item. Assign it to local variables to make
sure the same value assign to the buf_LRU_stat_sum
and item */
cur_stat = buf_LRU_stat_cur;
buf_LRU_stat_sum.io += cur_stat.io - item->io;
buf_LRU_stat_sum.unzip += cur_stat.unzip - item->unzip;
/* Put current entry in the array. */ /* Put current entry in the array. */
memcpy(item, &buf_LRU_stat_cur, sizeof *item); memcpy(item, &cur_stat, sizeof *item);
func_exit: func_exit:
/* Clear the current entry. */ /* Clear the current entry. */
......
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