summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index fecc35c95b9..2a9ec202860 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -456,7 +456,11 @@ Log_event::Log_event()
thd(0)
{
server_id= ::server_id;
- when= my_time(0);
+ /*
+ We can't call my_time() here as this would cause a call before
+ my_init() is called
+ */
+ when= 0;
log_pos= 0;
}
#endif /* !MYSQL_CLIENT */
@@ -688,6 +692,19 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
}
/*
+ Set time of when to when the query started. Since this function is
+ called from init_server_components() as well, it might be that the
+ current thread is not defined. In that case, we take the current
+ time instead. It is safe to call my_time() here since the first
+ time this line is reached is through the init_server_components()
+ call, which is after the my_init() call in the main() function (or
+ it's replacement, for some platforms).
+ */
+ THD *thd= current_thd;
+ if (!when)
+ when= thd ? thd->start_time : my_time(0);
+
+ /*
Header will be of size LOG_EVENT_HEADER_LEN for all events, except for
FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be
LOG_EVENT_MINIMAL_HEADER_LEN (remember these 2 have a frozen header,