diff options
author | Luis Soares <luis.soares@sun.com> | 2010-02-03 17:19:58 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2010-02-03 17:19:58 +0000 |
commit | 90a79ca4ad807241942869f6233b9fedf1ed58fd (patch) | |
tree | d4c383865865c897dc5f361924955f2260e97db1 /sql/rpl_mi.cc | |
parent | 5d6206d8824a193255786d25dadb8b97376e9141 (diff) | |
parent | 55aab082a957e3f20e94f791dbe44750b4b465c8 (diff) | |
download | mariadb-git-90a79ca4ad807241942869f6233b9fedf1ed58fd.tar.gz |
BUG#50364: manual merge to mysql-next-mr-bugfixing.
Conflicts
=========
Text conflict in sql/repl_failsafe.cc
Additional changes
==================
Replace references to pthread_mutex with mysql_mutex
Diffstat (limited to 'sql/rpl_mi.cc')
-rw-r--r-- | sql/rpl_mi.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 7f81834c1d3..7dad340cfa6 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -369,7 +369,7 @@ file '%s')", fname); mi->rli.is_relay_log_recovery= FALSE; // now change cache READ -> WRITE - must do this before flush_master_info reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); - if ((error=test(flush_master_info(mi, 1)))) + if ((error=test(flush_master_info(mi, TRUE, TRUE)))) sql_print_error("Failed to flush master info file"); mysql_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); @@ -395,7 +395,9 @@ err: 1 - flush master info failed 0 - all ok */ -int flush_master_info(Master_info* mi, bool flush_relay_log_cache) +int flush_master_info(Master_info* mi, + bool flush_relay_log_cache, + bool need_lock_relay_log) { IO_CACHE* file = &mi->file; char lbuf[22]; @@ -418,8 +420,19 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) */ if (flush_relay_log_cache) { + mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock(); IO_CACHE *log_file= mi->rli.relay_log.get_log_file(); - if (flush_io_cache(log_file)) + + if (need_lock_relay_log) + mysql_mutex_lock(log_lock); + + mysql_mutex_assert_owner(log_lock); + err= flush_io_cache(log_file); + + if (need_lock_relay_log) + mysql_mutex_unlock(log_lock); + + if (err) DBUG_RETURN(2); } |