diff options
author | unknown <monty@hundin.mysql.fi> | 2001-11-04 16:14:09 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-11-04 16:14:09 +0200 |
commit | 0d1ba873aa11ea581ebbda9f450027329f2e1a3b (patch) | |
tree | 689c9d0271e23431f1ab0ac09e1af4d68a58ca76 /sql/log.cc | |
parent | 9f90ff3f12f1fc2bcb70cde74dbd6f27e33e230c (diff) | |
parent | 0176dacd54b7eb62ebc4a81909b189517aee2cb4 (diff) | |
download | mariadb-git-0d1ba873aa11ea581ebbda9f450027329f2e1a3b.tar.gz |
merge with 3.23.44
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
Docs/manual.texi:
Auto merged
include/my_base.h:
Auto merged
mysql-test/t/func_time.test:
Auto merged
mysql-test/t/join.test:
Auto merged
mysql-test/t/rpl000012.test:
Auto merged
BUILD/FINISH.sh:
Auto merged
BitKeeper/deleted/.del-db_ext.h~a1e210bbd0de0a48:
Auto merged
BitKeeper/deleted/.del-mutex_ext.h~f20f47ddc346598b:
Auto merged
BitKeeper/deleted/.del-violite.c~984c09cffe14a11b:
Auto merged
BitKeeper/deleted/.del-violite.c~d7b85be615595ace:
Auto merged
Build-tools/Do-all-build-steps:
Auto merged
client/client_priv.h:
Auto merged
client/mysqladmin.c:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/include/univ.i:
Auto merged
innobase/log/log0log.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
isam/pack_isam.c:
Auto merged
libmysql_r/Makefile.am:
Auto merged
myisam/myisamchk.c:
Auto merged
mysql-test/t/having.test:
Auto merged
mysql-test/t/rpl000015-slave.sh:
Auto merged
mysql-test/t/rpl000016-slave.sh:
Auto merged
mysys/mf_cache.c:
Auto merged
mysys/mf_casecnv.c:
Auto merged
mysys/mf_tempfile.c:
Auto merged
readline/vi_mode.c:
Auto merged
strings/strto.c:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/time.cc:
Auto merged
BUILD/SETUP.sh:
Use -mcpu as default (safe for all x86 cpu's)
client/mysqldump.c:
Merge from 3.23.44
configure.in:
Update version number
extra/resolveip.c:
Portability fix
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/sql/log.cc b/sql/log.cc index 51bf077895a..b55d514058f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -516,36 +516,46 @@ bool MYSQL_LOG::is_active(const char* log_file_name) void MYSQL_LOG::new_file(bool inside_mutex) { - // only rotate open logs that are marked non-rotatable - // (binlog with constant name are non-rotatable) - if (is_open() && ! no_rotate) + if (is_open()) { char new_name[FN_REFLEN], *old_name=name; if (!inside_mutex) VOID(pthread_mutex_lock(&LOCK_log)); - if (generate_new_name(new_name, name)) - { - if (!inside_mutex) - VOID(pthread_mutex_unlock(&LOCK_log)); - return; // Something went wrong - } - if (log_type == LOG_BIN) + + if (!no_rotate) { /* - We log the whole file name for log file as the user may decide - to change base names at some point. + only rotate open logs that are marked non-rotatable + (binlog with constant name are non-rotatable) */ - THD* thd = current_thd; - Rotate_log_event r(thd,new_name+dirname_length(new_name)); - r.set_log_seq(0, this); - // this log rotation could have been initiated by a master of - // the slave running with log-bin - // we set the flag on rotate event to prevent inifinite log rotation - // loop - if(thd && slave_thd && thd == slave_thd) - r.flags |= LOG_EVENT_FORCED_ROTATE_F; - r.write(&log_file); - VOID(pthread_cond_broadcast(&COND_binlog_update)); + if (generate_new_name(new_name, name)) + { + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); + return; // Something went wrong + } + if (log_type == LOG_BIN) + { + /* + 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; + Rotate_log_event r(thd,new_name+dirname_length(new_name)); + r.set_log_seq(0, this); + + /* + This log rotation could have been initiated by a master of + the slave running with log-bin we set the flag on rotate + event to prevent inifinite log rotation loop + */ + if (thd && slave_thd && thd == slave_thd) + r.flags |= LOG_EVENT_FORCED_ROTATE_F; + r.write(&log_file); + VOID(pthread_cond_broadcast(&COND_binlog_update)); + } + else + strmov(new_name, old_name); // Reopen old file name } name=0; close(); @@ -843,7 +853,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, { /* For slow query log */ if (my_b_printf(&log_file, - "# Time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n", + "# Query_time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n", (ulong) (current_time - query_start), (ulong) (thd->time_after_lock - query_start), (ulong) thd->sent_row_count, |