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

Merge branch '11.2' into 11.4

This commit is contained in:
Oleksandr Byelkin
2024-10-30 09:24:04 +01:00
734 changed files with 10187 additions and 4442 deletions

View File

@@ -360,10 +360,8 @@ void Active_tranx::unlink_thd_as_waiter(const char *log_file_name,
DBUG_VOID_RETURN;
}
#ifndef DBUG_OFF
void Active_tranx::assert_thd_is_waiter(THD *thd_to_check,
const char *log_file_name,
my_off_t log_file_pos)
bool Active_tranx::is_thd_waiter(THD *thd_to_check, const char *log_file_name,
my_off_t log_file_pos)
{
DBUG_ENTER("Active_tranx::assert_thd_is_waiter");
mysql_mutex_assert_owner(m_lock);
@@ -379,13 +377,8 @@ void Active_tranx::assert_thd_is_waiter(THD *thd_to_check,
entry = entry->hash_next;
}
DBUG_ASSERT(entry);
DBUG_ASSERT(entry->thd);
DBUG_ASSERT(entry->thd->thread_id == thd_to_check->thread_id);
DBUG_VOID_RETURN;
DBUG_RETURN(static_cast<bool>(entry));
}
#endif
/*******************************************************************************
*
@@ -922,6 +915,36 @@ int Repl_semi_sync_master::commit_trx(const char *trx_wait_binlog_name,
}
}
/* In between the binlogging of this transaction and this wait, it is
* possible that our entry in Active_tranx was removed (i.e. if
* semi-sync was switched off and on). It is also possible that the
* event was already sent to a replica; however, we don't know if
* semi-sync was on or off at that time, so an ACK may never come. So
* skip the wait. Note that rpl_semi_sync_master_request_acks was
* already incremented in report_binlog_update(), so to keep
* rpl_semi_sync_master_yes/no_tx consistent with it, we check for a
* semi-sync restart _after_ checking the reply state.
*/
if (unlikely(!m_active_tranxs->is_thd_waiter(thd, trx_wait_binlog_name,
trx_wait_binlog_pos)))
{
DBUG_EXECUTE_IF(
"semisync_log_skip_trx_wait",
sql_print_information(
"Skipping semi-sync wait for transaction at pos %s, %lu. This "
"should be because semi-sync turned off and on during the "
"lifetime of this transaction.",
trx_wait_binlog_name, trx_wait_binlog_pos););
/* The only known reason for a missing entry at this point is if
* semi-sync was turned off then on, so on debug builds, we track
* the number of times semi-sync turned off at binlogging, and compare
* to the current value. */
DBUG_ASSERT(rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs);
break;
}
/* Let us update the info about the minimum binlog position of waiting
* threads.
*/
@@ -968,10 +991,6 @@ int Repl_semi_sync_master::commit_trx(const char *trx_wait_binlog_name,
m_wait_timeout,
m_wait_file_name, (ulong)m_wait_file_pos));
#ifndef DBUG_OFF
m_active_tranxs->assert_thd_is_waiter(thd, trx_wait_binlog_name,
trx_wait_binlog_pos);
#endif
create_timeout(&abstime, &start_ts);
wait_result= mysql_cond_timedwait(&thd->COND_wakeup_ready, &LOCK_binlog,
&abstime);
@@ -1307,6 +1326,10 @@ int Repl_semi_sync_master::write_tranx_in_binlog(THD *thd,
else
{
rpl_semi_sync_master_request_ack++;
#ifndef DBUG_OFF
thd->expected_semi_sync_offs= rpl_semi_sync_master_off_times;
#endif
}
}