diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-01-20 12:51:20 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-01-28 17:39:07 +0400 |
commit | 891be49a36ebb951cd90d64d1b4c1cc633af1fdf (patch) | |
tree | 2388b9b4e75396e0423a2522eee02bd85d02097c /sql/sql_repl.cc | |
parent | c88fd54d171fdba6aad3f7e16a4060cca03143d3 (diff) | |
download | mariadb-git-891be49a36ebb951cd90d64d1b4c1cc633af1fdf.tar.gz |
Simplified THD::current_linfo locking
LOG_INFO::lock was useless. It could've only protect against concurrent
iterators execution, which was already protected by LOCK_thread_count.
Use LOCK_thd_data instead of LOCK_thread_count as a protection against
THD::current_linfo reset.
Aim is to reduce usage of LOCK_thread_count and COND_thread_count.
Part of MDEV-15135.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 1847416368a..ab4a5c6a6b4 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -537,9 +537,9 @@ void adjust_linfo_offsets(my_off_t purge_offset) while ((tmp=it++)) { LOG_INFO* linfo; + mysql_mutex_lock(&tmp->LOCK_thd_data); if ((linfo = tmp->current_linfo)) { - mysql_mutex_lock(&linfo->lock); /* Index file offset can be less that purge offset only if we just started reading the index file. In that case @@ -549,8 +549,8 @@ void adjust_linfo_offsets(my_off_t purge_offset) linfo->fatal = (linfo->index_file_offset != 0); else linfo->index_file_offset -= purge_offset; - mysql_mutex_unlock(&linfo->lock); } + mysql_mutex_unlock(&tmp->LOCK_thd_data); } mysql_mutex_unlock(&LOCK_thread_count); } @@ -568,14 +568,12 @@ bool log_in_use(const char* log_name) while ((tmp=it++)) { LOG_INFO* linfo; + mysql_mutex_lock(&tmp->LOCK_thd_data); if ((linfo = tmp->current_linfo)) - { - mysql_mutex_lock(&linfo->lock); result = !memcmp(log_name, linfo->log_file_name, log_name_len); - mysql_mutex_unlock(&linfo->lock); - if (result) - break; - } + mysql_mutex_unlock(&tmp->LOCK_thd_data); + if (result) + break; } mysql_mutex_unlock(&LOCK_thread_count); |