1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-29843 Do not use asynchronous log_write_upto() for system THDs

Non-blocking log_write_upto (MDEV-24341) was only designed  for the
client connections. Fix, so it is not be triggered for any system THD.

Previously, an incomplete solution only excluded Innodb purge THDs, but
not  the slave for example.

The hang in MDEV still remains somewhat a mystery though, it is not
immediately clear how exactly condition variable can become corrupted.
But it is clear that it can be avoided.
This commit is contained in:
Vladislav Vaintroub
2022-10-25 08:53:56 +02:00
parent 5dd411c79a
commit b7fe6179e8
5 changed files with 17 additions and 24 deletions

View File

@ -5127,12 +5127,22 @@ void reset_thd(MYSQL_THD thd)
before writing response to client, to provide durability
guarantees, in other words, server can't send OK packet
before modified data is durable in redo log.
*/
extern "C" void thd_increment_pending_ops(MYSQL_THD thd)
NOTE: system THD (those that are not associated with client
connection) do not allows async operations yet.
@param thd a THD
@return thd
@retval nullptr if this is system THD */
extern "C" MYSQL_THD thd_increment_pending_ops(MYSQL_THD thd)
{
if (!thd || thd->system_thread != NON_SYSTEM_THREAD)
return nullptr;
thd->async_state.inc_pending_ops();
return thd;
}
/**
This function can be used by plugin/engine to indicate
end of async operation (such as end of group commit
@ -5143,6 +5153,8 @@ extern "C" void thd_increment_pending_ops(MYSQL_THD thd)
extern "C" void thd_decrement_pending_ops(MYSQL_THD thd)
{
DBUG_ASSERT(thd);
DBUG_ASSERT(thd->system_thread == NON_SYSTEM_THREAD);
thd_async_state::enum_async_state state;
if (thd->async_state.dec_pending_ops(&state) == 0)
{