MDEV-35281 SR transaction crashes with innodb_snapshot_isolation

Ignore snapshot isolation conflict during fragment removal, before
streaming transaction commits. This happens when a streaming
transaction creates a read view that precedes the INSERTion of
fragments into the streaming_log table. Fragments are INSERTed
using a different transaction. These fragment are then removed
as part of COMMIT of the streaming transaction. This fragment
removal operation could fail when the fragments were not part
the transaction's read view, thus violating snapshot isolation.
This commit is contained in:
Daniele Sciascia
2024-10-29 10:47:20 +01:00
parent f5aed74573
commit e821c9fa7c
5 changed files with 74 additions and 4 deletions

View File

@ -183,6 +183,25 @@ private:
my_bool m_wsrep_ignore_table;
};
class wsrep_skip_locking
{
public:
wsrep_skip_locking(THD *thd)
: m_thd(thd)
, m_wsrep_skip_locking(thd->wsrep_skip_locking)
{
thd->wsrep_skip_locking= true;
}
~wsrep_skip_locking()
{
m_thd->wsrep_skip_locking= m_wsrep_skip_locking;
}
private:
THD *m_thd;
my_bool m_wsrep_skip_locking;
};
class thd_server_status
{
public:
@ -1235,6 +1254,7 @@ int Wsrep_schema::remove_fragments(THD* thd,
Wsrep_schema_impl::wsrep_ignore_table wsrep_ignore_table(thd);
Wsrep_schema_impl::binlog_off binlog_off(thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd);
Wsrep_schema_impl::wsrep_skip_locking skip_locking(thd);
Query_tables_list query_tables_list_backup;
Open_tables_backup open_tables_backup;