summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2014-10-08 21:54:35 +0530
committerVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2014-10-08 21:54:35 +0530
commit0827d756276dfaaeac6873daae852c8263146294 (patch)
tree05ded92647b28f5e59f363fc4e2d255844e25b9d /client
parent929680913417e6a09330376b9d99f3bf33db7ff3 (diff)
downloadmariadb-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 'client')
-rw-r--r--client/mysqlbinlog.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index dbc30680959..73a801c4b21 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1,5 +1,5 @@
/*
- 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
@@ -2102,6 +2102,7 @@ int main(int argc, char** argv)
DBUG_PROCESS(argv[0]);
my_init_time(); // for time functions
+ tzset(); // set tzname
if (load_defaults("my", load_default_groups, &argc, &argv))
exit(1);