Skip to content

Commit 3241798

Browse files
emoonrainFooBarrior
authored andcommitted
MDEV-37686 rpl.create_or_replace_mix2 fails in MDEV-35915 branch
The test failed as the Jira ticket describes because of insufficient main transaction isolation from an out-of-band dynamic "new" transaction. Specifically the replicated transaction's temporary tables became accessible to the "new" transaction. The fixes ensure the "new" transaction can't reach any piece of replication transaction execution context, the temporary table list including. This is safe as by so far start_new_trans class instances need not any replication info, as it must've been anticipated by design.
1 parent b9c3ee3 commit 3241798

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sql/sql_class.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6359,6 +6359,8 @@ start_new_trans::start_new_trans(THD *thd)
63596359
thd->server_status&= ~(SERVER_STATUS_IN_TRANS |
63606360
SERVER_STATUS_IN_TRANS_READONLY);
63616361
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
6362+
org_rgi_slave= thd->rgi_slave;
6363+
thd->rgi_slave= NULL;
63626364
}
63636365

63646366

@@ -6375,6 +6377,7 @@ void start_new_trans::restore_old_transaction()
63756377
MYSQL_COMMIT_TRANSACTION(org_thd->m_transaction_psi);
63766378
org_thd->m_transaction_psi= m_transaction_psi;
63776379
org_thd->variables.wsrep_on= wsrep_on;
6380+
org_thd->rgi_slave= org_rgi_slave;
63786381
org_thd= 0;
63796382
}
63806383

sql/sql_class.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5882,6 +5882,11 @@ class start_new_trans
58825882
uint in_sub_stmt;
58835883
uint server_status;
58845884
my_bool wsrep_on;
5885+
/*
5886+
THD:rgi_slave may hold a part of the replicated "old" transaction's
5887+
execution context. Therefore it has to be reset/restored too.
5888+
*/
5889+
rpl_group_info* org_rgi_slave;
58855890

58865891
public:
58875892
start_new_trans(THD *thd);

0 commit comments

Comments
 (0)