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 | 0827d756276dfaaeac6873daae852c8263146294 (patch) | |
tree | 05ded92647b28f5e59f363fc4e2d255844e25b9d /mysys | |
parent | 929680913417e6a09330376b9d99f3bf33db7ff3 (diff) | |
download | mariadb-git-0827d756276dfaaeac6873daae852c8263146294.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 'mysys')
-rw-r--r-- | mysys/my_wincond.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index 4794bb391b6..ac0166c87b8 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -344,26 +344,4 @@ int pthread_attr_destroy(pthread_attr_t *connect_att) return 0; } -/**************************************************************************** -** Fix localtime_r() to be a bit safer -****************************************************************************/ - -struct tm *localtime_r(const time_t *timep,struct tm *tmp) -{ - if (*timep == (time_t) -1) /* This will crash win32 */ - { - bzero(tmp,sizeof(*tmp)); - } - else - { - struct tm *res=localtime(timep); - if (!res) /* Wrong date */ - { - bzero(tmp,sizeof(*tmp)); /* Keep things safe */ - return 0; - } - *tmp= *res; - } - return tmp; -} #endif /* __WIN__ */ |