diff options
author | Venkatesh Duggirala <venkatesh.duggirala@oracle.com> | 2014-10-08 21:54:35 +0530 |
---|---|---|
committer | Venkatesh Duggirala <venkatesh.duggirala@oracle.com> | 2014-10-08 21:54:35 +0530 |
commit | a3cc647dbdbdeb0f2e9c9ac55ffe062c659d82dc (patch) | |
tree | 05ded92647b28f5e59f363fc4e2d255844e25b9d /sql | |
parent | 0d0c59ff8092e0added553e48d271628574a32c4 (diff) | |
download | mariadb-git-a3cc647dbdbdeb0f2e9c9ac55ffe062c659d82dc.tar.gz |
Bug #18808072 MYSQLBINLOG USES LOCALTIME() TO PRINT EVENTS, CAUSES KERNEL MUTEX CONTENTION
Problem: For every event read, mysqlbinlog calls localtime() which in turn
calls stat(/etc/localtime) which is causing kernel mutex contention.
Analysis and Fix:
localtime() calls stat(/etc/localtime) for every instance of the call
where as localtime_r() the reentrant version was optimized to store
the read only tz internal structure. Hence it will not call
stat(/etc/localtime). It will call only once at the beginning.
The mysql server is calling localtime_r() and mysqlbinlog tool is
one place where we are still using localtime().
Once the process (mysqlbinlog) is started if timezone is changed
it will be not picked up the the process and it will continue
with the same values as the beginning of the process. This
behavior is in-lined with mysql server.
Also adding localtime_r() and gmtime_r() support for windows.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log_event.cc | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 403c512ab3a..38efb2a9c6b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2162,13 +2162,8 @@ void Log_event::print_timestamp(IO_CACHE* file, time_t* ts) DBUG_ENTER("Log_event::print_timestamp"); if (!ts) ts = &when; -#ifdef MYSQL_SERVER // This is always false struct tm tm_tmp; localtime_r(ts,(res= &tm_tmp)); -#else - res=localtime(ts); -#endif - my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d", res->tm_year % 100, res->tm_mon+1, |