1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.9' into 10.10

This commit is contained in:
Oleksandr Byelkin
2023-08-05 16:14:46 +02:00
867 changed files with 12543 additions and 6345 deletions

View File

@@ -1900,7 +1900,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))
@@ -3263,6 +3266,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;
}
@@ -4284,7 +4295,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);
});
@@ -4301,7 +4311,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;
@@ -4356,9 +4367,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)
{