From: prabakaran thirumalai Date: November 29 2012 4:10am Subject: bzr push into mysql-trunk branch (prabakaran.thirumalai:5112 to 5113) Bug#14342521 List-Archive: http://lists.mysql.com/commits/145404 X-Bug: 14342521 Message-Id: <201211290410.qAT4AYRr021906@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 5113 prabakaran thirumalai 2012-11-29 Bug#14342521 GLOBAL VARIABLE TC_LOG_CUR_PAGES_USED IS NOT GUARDED BY MUTEX Description: Global status variables such as tc_log_cur_pages_used and tc_log_max_pages_used are not guarded. Analysis: When SAFE_STATISTICS is defined, except above mentioned status variables, others are guarded either by LOCK_status or functionality specific mutexes such as LOCK_thread_count. Fix: Acquire LOCK_status write lock while modifying above mentioned global variables when SAFE_STATISTICS is defined. modified: include/my_pthread.h sql/log.cc 5112 Marc Alff 2012-11-28 [merge] Merge mysql-5.6 --> mysql-trunk modified: storage/perfschema/pfs_autosize.cc === modified file 'include/my_pthread.h' --- a/include/my_pthread.h 2012-11-21 12:20:11 +0000 +++ b/include/my_pthread.h 2012-11-29 03:51:45 +0000 @@ -934,6 +934,14 @@ extern uint thd_lib_detected; #define statistic_sub(V,C,L) thread_safe_sub((V),(C),(L)) #define statistic_add_rwlock(V,C,L) thread_safe_add_rwlock((V),(C),(L)) #define statistic_sub_rwlock(V,C,L) thread_safe_sub_rwlock((V),(C),(L)) +#define statistic_inc_set_big_rwlock(V,B,L) \ + do { \ + mysql_rwlock_wrlock((L)); \ + (V)++; \ + set_if_bigger((B),(V)); \ + mysql_rwlock_unlock((L)); \ + } while(0) + #else #define statistic_decrement(V,L) (V)-- #define statistic_increment(V,L) (V)++ @@ -943,6 +951,12 @@ extern uint thd_lib_detected; #define statistic_sub(V,C,L) (V)-=(C) #define statistic_add_rwlock(V,C,L) (V)+=(C) #define statistic_sub_rwlock(V,C,L) (V)-=(C) +#define statistic_inc_set_big_rwlock(V,B,L) \ + do { \ + (V)++; \ + set_if_bigger((B),(V)); \ + } while(0) + #endif /* SAFE_STATISTICS */ /* === modified file 'sql/log.cc' --- a/sql/log.cc 2012-11-21 12:44:48 +0000 +++ b/sql/log.cc 2012-11-29 03:51:45 +0000 @@ -2609,8 +2609,8 @@ void TC_LOG_MMAP::get_active_from_pool() active=*best_p; if (active->free == active->size) // we've chosen an empty page { - tc_log_cur_pages_used++; - set_if_bigger(tc_log_max_pages_used, tc_log_cur_pages_used); + statistic_inc_set_big_rwlock(tc_log_cur_pages_used, tc_log_max_pages_used, + &LOCK_status); } if ((*best_p)->next) // unlink the page from the pool No bundle (reason: useless for push emails).