diff options
author | Luis Soares <luis.soares@oracle.com> | 2012-03-12 12:28:27 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@oracle.com> | 2012-03-12 12:28:27 +0000 |
commit | 5360c4e5bcb29d90c36c775a5f874fefaa4a671b (patch) | |
tree | 9411c5074bd97730fbb89aeff3ccc306902ddfe8 /sql/log.cc | |
parent | 0664bb7cd0c837ed168c7f8223157e3c5ce0a03c (diff) | |
download | mariadb-git-5360c4e5bcb29d90c36c775a5f874fefaa4a671b.tar.gz |
BUG#12400313 RELAY_LOG_SPACE_LIMIT IS NOT WORKING IN MANY CASES
BUG#64503: mysql frequently ignores --relay-log-space-limit
When the SQL thread goes to sleep, waiting for more events, it sets
the flag ignore_log_space_limit to true. This gives the IO thread a
chance to queue some more events and ultimately the SQL thread will be
able to purge the log once it is rotated. By then the SQL thread
resets the ignore_log_space_limit to false. However, between the time
the SQL thread has set the ignore flag and the time it resets it, the
IO thread will be queuing events in the relay log, possibly going way
over the limit.
This patch makes the IO and SQL thread to synchronize when they reach
the space limit and only ask for one event at a time. Thus the SQL
thread sets ignore_log_space_limit flag and the IO thread resets it to
false everytime it processes one more event. In addition, everytime
the SQL thread processes the next event, and the limit has been
reached, it checks if the IO thread should rotate. If it should, it
instructs the IO thread to rotate, giving the SQL thread a chance to
purge the logs (freeing space). Finally, this patch removes the
resetting of the ignore_log_space_limit flag from purge_first_log,
because this is now reset by the IO thread every time it processes the
next event when the limit has been reached.
If the SQL thread is in a transaction, it cannot purge so, there is no
point in asking the IO thread to rotate. The only thing it can do is
to ask for more events until the transaction is over (then it can ask
the IO to rotate and purge the log right away). Otherwise, there would
be a deadlock (SQL would not be able to purge and IO thread would not
be able to queue events so that the SQL would finish the transaction).
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/sql/log.cc b/sql/log.cc index cca403ca1be..3714f1190be 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3194,8 +3194,6 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) pthread_mutex_lock(&rli->log_space_lock); rli->relay_log.purge_logs(to_purge_if_included, included, 0, 0, &rli->log_space_total); - // Tell the I/O thread to take the relay_log_space_limit into account - rli->ignore_log_space_limit= 0; pthread_mutex_unlock(&rli->log_space_lock); /* |