mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.6' into 10.9
This commit is contained in:
36
sql/slave.cc
36
sql/slave.cc
@@ -1897,7 +1897,10 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
|
||||
{
|
||||
mysql_mutex_lock(&mi->data_lock);
|
||||
mi->clock_diff_with_master=
|
||||
(long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10));
|
||||
(DBUG_IF("negate_clock_diff_with_master") ?
|
||||
0:
|
||||
(long) (time((time_t *) 0) - strtoul(master_row[0], 0, 10)));
|
||||
|
||||
mysql_mutex_unlock(&mi->data_lock);
|
||||
}
|
||||
else if (check_io_slave_killed(mi, NULL))
|
||||
@@ -3252,6 +3255,14 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
||||
else
|
||||
{
|
||||
idle= mi->rli.sql_thread_caught_up;
|
||||
|
||||
/*
|
||||
The idleness of the SQL thread is needed for the parallel slave
|
||||
because events can be ignored before distribution to a worker thread.
|
||||
That is, Seconds_Behind_Master should still be calculated and visible
|
||||
while the slave is processing ignored events, such as those skipped
|
||||
due to slave_skip_counter.
|
||||
*/
|
||||
if (mi->using_parallel() && idle && !mi->rli.parallel.workers_idle())
|
||||
idle= false;
|
||||
}
|
||||
@@ -4273,7 +4284,6 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
thd,
|
||||
STRING_WITH_LEN(
|
||||
"now SIGNAL paused_on_event WAIT_FOR sql_thread_continue")));
|
||||
DBUG_SET("-d,pause_sql_thread_on_next_event");
|
||||
mysql_mutex_lock(&rli->data_lock);
|
||||
});
|
||||
|
||||
@@ -4290,7 +4300,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
the user might be surprised to see a claim that the slave is up to date
|
||||
long before those queued events are actually executed.
|
||||
*/
|
||||
if ((!rli->mi->using_parallel()) && event_can_update_last_master_timestamp(ev))
|
||||
if ((!rli->mi->using_parallel()) &&
|
||||
event_can_update_last_master_timestamp(ev))
|
||||
{
|
||||
rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
|
||||
rli->sql_thread_caught_up= false;
|
||||
@@ -4345,9 +4356,22 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
|
||||
if (rli->mi->using_parallel())
|
||||
{
|
||||
if (unlikely((rli->last_master_timestamp == 0 ||
|
||||
rli->sql_thread_caught_up) &&
|
||||
event_can_update_last_master_timestamp(ev)))
|
||||
/*
|
||||
rli->sql_thread_caught_up is checked and negated here to ensure that
|
||||
the value of Seconds_Behind_Master in SHOW SLAVE STATUS is consistent
|
||||
with the update of last_master_timestamp. It was previously unset
|
||||
immediately after reading an event from the relay log; however, for the
|
||||
duration between that unset and the time that LMT would be updated
|
||||
could lead to spikes in SBM.
|
||||
|
||||
The check for queued_count == dequeued_count ensures the worker threads
|
||||
are all idle (i.e. all events have been executed).
|
||||
*/
|
||||
if ((unlikely(rli->last_master_timestamp == 0) ||
|
||||
(rli->sql_thread_caught_up &&
|
||||
(rli->last_inuse_relaylog->queued_count ==
|
||||
rli->last_inuse_relaylog->dequeued_count))) &&
|
||||
event_can_update_last_master_timestamp(ev))
|
||||
{
|
||||
if (rli->last_master_timestamp < ev->when)
|
||||
{
|
||||
|
Reference in New Issue
Block a user