summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-03-09 12:29:51 +0100
committerunknown <serg@serg.mylan>2005-03-09 12:29:51 +0100
commita0f63f1b81bbe1b6312abab035cbf622970023cb (patch)
tree95219d3b710ca7440791ed606fa1dbbec32d170a /sql/log.cc
parentb7943b7aee28e468e58436abf856d7f93496e547 (diff)
downloadmariadb-git-a0f63f1b81bbe1b6312abab035cbf622970023cb.tar.gz
don't close binlog in the destructor - use explictit MYSQL_LOG::cleanup for this
mysql-test/r/fulltext.result: new test, duplicate test removed mysql-test/t/fulltext.test: new test, duplicate test removed sql/slave.cc: close relay log explicitly
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 5d77197a9b9..ae06e37611d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -360,12 +360,6 @@ MYSQL_LOG::MYSQL_LOG()
bzero((char*) &index_file, sizeof(index_file));
}
-
-MYSQL_LOG::~MYSQL_LOG()
-{
- cleanup();
-}
-
/* this is called only once */
void MYSQL_LOG::cleanup()
@@ -1276,8 +1270,7 @@ bool MYSQL_LOG::is_active(const char *log_file_name_arg)
SYNOPSIS
new_file()
- need_lock Set to 1 (default) if caller has not locked
- LOCK_log and LOCK_index
+ need_lock Set to 1 if caller has not locked LOCK_log
NOTE
The new file name is stored last in the index file
@@ -1764,12 +1757,13 @@ err:
void MYSQL_LOG::rotate_and_purge(uint flags)
{
+ if (!(flags & RP_LOCK_LOG_IS_ALREADY_LOCKED))
+ pthread_mutex_lock(&LOCK_log);
if ((flags & RP_FORCE_ROTATE) ||
(my_b_tell(&log_file) >= (my_off_t) max_size))
{
- new_file(!(flags & RP_LOCK_LOG_IS_ALREADY_LOCKED));
+ new_file(0);
#ifdef HAVE_REPLICATION
- // QQ why do we need #ifdef here ???
if (expire_logs_days)
{
long purge_time= time(0) - expire_logs_days*24*60*60;
@@ -1778,6 +1772,8 @@ void MYSQL_LOG::rotate_and_purge(uint flags)
}
#endif
}
+ if (!(flags & RP_LOCK_LOG_IS_ALREADY_LOCKED))
+ pthread_mutex_unlock(&LOCK_log);
}
uint MYSQL_LOG::next_file_id()