Skip to content

Commit a940151

Browse files
authored
MDEV-21988: Assertion failure mysqld: bool trans_commit_stmt(THD*): Assertion `thd->in_active_multi_stmt_transaction() || thd->m_transaction_psi == __null' failed. (#1476)
Set temporary `SERVER_STATUS_IN_TRANS` so assert is not triggered in `trans_commit_stmt`.
1 parent fbfd4fa commit a940151

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

sql/wsrep_schema.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@ class wsrep_off
139139
my_bool m_wsrep_on;
140140
};
141141

142+
class thd_server_status
143+
{
144+
public:
145+
thd_server_status(THD* thd, uint server_status, bool condition)
146+
: m_thd(thd)
147+
, m_thd_server_status(thd->server_status)
148+
{
149+
if (condition)
150+
thd->server_status= server_status;
151+
}
152+
~thd_server_status()
153+
{
154+
m_thd->server_status= m_thd_server_status;
155+
}
156+
private:
157+
THD* m_thd;
158+
uint m_thd_server_status;
159+
};
160+
142161
class thd_context_switch
143162
{
144163
public:
@@ -1094,6 +1113,9 @@ int Wsrep_schema::remove_fragments(THD* thd,
10941113
}
10951114
else
10961115
{
1116+
Wsrep_schema_impl::thd_server_status
1117+
thd_server_status(thd, thd->server_status | SERVER_STATUS_IN_TRANS,
1118+
thd->in_multi_stmt_transaction_mode());
10971119
Wsrep_schema_impl::finish_stmt(thd);
10981120
}
10991121

0 commit comments

Comments
 (0)