diff options
author | unknown <guilhem@mysql.com> | 2003-12-08 16:18:25 +0100 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-12-08 16:18:25 +0100 |
commit | a50761a565a07f4d0494d0193f15a80b57fc7108 (patch) | |
tree | 6dfcb95855b457d5a4207559902c7f4ee45af48b /sql/log.cc | |
parent | 1057ca5405f678f3005a26a183a77d74b0906214 (diff) | |
download | mariadb-git-a50761a565a07f4d0494d0193f15a80b57fc7108.tar.gz |
Fix for BUG#2045 "Sending SIGHUP to mysqld crashes it if running with --log-bin".
The constructor of Rotate_log_event used when we are rotating our binlog or
relay log, should not assume that there is a nonzero THD available.
For example, when we are reacting to SIGHUP, the THD is 0.
In fact we don't need to use the THD in this constructor;
we can do like for Stop_log_event, and use the minimal Log_event
constructor.
If we were allowed to put Unix-specific commands in the testsuite,
I'd add a test for this (<sigh>).
sql/log.cc:
A comment to warn that thd can be 0.
The part about LOG_EVENT_FORCED_ROTATE_F is just to avoid segfault;
this flag is already removed in 4.1 anyway.
sql/log_event.cc:
A comment.
sql/log_event.h:
The constructor of Rotate_log_event used when we are rotating our binlog or
relay log, should not assume that there is a nonzero THD available.
For example, when we are reacting to SIGHUP, the THD is 0.
In fact we don't need to use the THD in this constructor;
we can do like for Stop_log_event, and use the minimal Log_event
constructor.
This fixes BUG#2045
"Sending SIGHUP to mysqld crashes it if running with --log-bin"
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 4 |
1 files changed, 2 insertions, 2 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(); |