diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 10:47:50 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 10:47:50 -0300 |
commit | 649390ac814ce5ea1e77b833ab5fe92dfcfe86d5 (patch) | |
tree | ac8b15ac65b08a492c256369b73e372f6568c7a4 /sql/rpl_mi.cc | |
parent | 06b8897e8e9a27b6ffc562af90153ab63f30e63e (diff) | |
parent | 8df20918d6751dc1eeb47ab722269dbd9d2da297 (diff) | |
download | mariadb-git-649390ac814ce5ea1e77b833ab5fe92dfcfe86d5.tar.gz |
Merge of mysql-trunk-bugfixing into mysql-trunk-merge.
Diffstat (limited to 'sql/rpl_mi.cc')
-rw-r--r-- | sql/rpl_mi.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index a775d3485c9..cda876ee764 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -164,7 +164,29 @@ int init_master_info(Master_info* mi, const char* master_info_fname, */ if (thread_mask & SLAVE_SQL) { + bool hot_log= FALSE; + /* + my_b_seek does an implicit flush_io_cache, so we need to: + + 1. check if this log is active (hot) + 2. if it is we keep log_lock until the seek ends, otherwise + release it right away. + + If we did not take log_lock, SQL thread might race with IO + thread for the IO_CACHE mutex. + + */ + mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock(); + mysql_mutex_lock(log_lock); + hot_log= mi->rli.relay_log.is_active(mi->rli.linfo.log_file_name); + + if (!hot_log) + mysql_mutex_unlock(log_lock); + my_b_seek(mi->rli.cur_log, (my_off_t) 0); + + if (hot_log) + mysql_mutex_unlock(log_lock); } DBUG_RETURN(0); } @@ -495,7 +517,7 @@ int flush_master_info(Master_info* mi, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert, heartbeat_buf, "", ignore_server_ids_buf); - my_free(ignore_server_ids_buf, MYF(0)); + my_free(ignore_server_ids_buf); err= flush_io_cache(file); if (sync_masterinfo_period && !err && ++(mi->sync_counter) >= sync_masterinfo_period) |