summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-12-08 20:47:42 +0100
committerunknown <guilhem@mysql.com>2003-12-08 20:47:42 +0100
commitc121a7357046a64463cdb597e0fd28d4015113e2 (patch)
tree027ffda5c63ef111f9a9eea514422a9d7c57ec8c
parentda3e63e1264290e8ea1a3f7c24224208156e4991 (diff)
parenta50761a565a07f4d0494d0193f15a80b57fc7108 (diff)
downloadmariadb-git-c121a7357046a64463cdb597e0fd28d4015113e2.tar.gz
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
-rw-r--r--sql/log.cc4
-rw-r--r--sql/log_event.cc7
-rw-r--r--sql/log_event.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/sql/log.cc b/sql/log.cc
index e6eaa3b802c..8bd42d28e59 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -843,7 +843,7 @@ void MYSQL_LOG::new_file(bool need_lock)
We log the whole file name for log file as the user may decide
to change base names at some point.
*/
- THD* thd = current_thd;
+ THD* thd = current_thd; /* may be 0 if we are reacting to SIGHUP */
Rotate_log_event r(thd,new_name+dirname_length(new_name));
r.set_log_pos(this);
@@ -852,7 +852,7 @@ void MYSQL_LOG::new_file(bool need_lock)
the slave running with log-bin, we set the flag on rotate
event to prevent infinite log rotation loop
*/
- if (thd->slave_thread)
+ if (thd && thd->slave_thread)
r.flags|= LOG_EVENT_FORCED_ROTATE_F;
r.write(&log_file);
bytes_written += r.get_event_len();
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d17c94a2b44..9779b7401dd 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -128,7 +128,12 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)));
}
-
+/*
+ This minimal constructor is for when you are not even sure that there is a
+ valid THD. For example in the server when we are shutting down or flushing
+ logs after receiving a SIGHUP (then we must write a Rotate to the binlog but
+ we have no THD, so we need this minimal constructor).
+*/
Log_event::Log_event()
:temp_buf(0), exec_time(0), cached_event_len(0), flags(0), cache_stmt(0),
thd(0)
diff --git a/sql/log_event.h b/sql/log_event.h
index 929d550951e..a1a7798be34 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -607,7 +607,7 @@ public:
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
uint ident_len_arg = 0,
ulonglong pos_arg = LOG_EVENT_OFFSET)
- :Log_event(thd_arg,0,0), new_log_ident(new_log_ident_arg),
+ :Log_event(), new_log_ident(new_log_ident_arg),
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
(uint) strlen(new_log_ident_arg)), alloced(0)
{}