summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-11-01 10:33:44 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-11-01 10:33:44 +0100
commitebf2121529fcf06971b4c0fc28f40654ef8dd99f (patch)
tree420ddcc5b2aeae06a75224062e85ee8b1ffce504 /sql/sql_class.cc
parent4b87d3628acf815836c0efc84fbcd878517d9b89 (diff)
parente0421b7cc8969edefca25c9a47e24f7e77c4bdf6 (diff)
downloadmariadb-git-ebf2121529fcf06971b4c0fc28f40654ef8dd99f.tar.gz
Merge branch '10.8' into 10.9
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 14f93241ce3..8644eade158 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -5112,12 +5112,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
@@ -5128,6 +5138,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)
{