Skip to content

Commit

Permalink
MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection
Browse files Browse the repository at this point in the history
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
  • Loading branch information
knielsen committed Nov 20, 2023
1 parent 7aca66a commit d415f60
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
14 changes: 14 additions & 0 deletions mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'### MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection'
connect con1,localhost,root,,;
BINLOG '
6ENbZQ8BAAAA/AAAAAABAAAAAAQAMTAuMTEuNi1NYXJpYURCLWRlYnVnLWxvZwAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAADoQ1tlEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAEEwQADQgICAoKCgGbvv33
';
disconnect con1;
connect con1,localhost,root,,;
SET SESSION pseudo_slave_mode= 1;
disconnect con1;
connection default;
20 changes: 20 additions & 0 deletions mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--source include/not_embedded.inc
--source include/load_sysvars.inc

--echo '### MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection'
--connect(con1,localhost,root,,)
BINLOG '
6ENbZQ8BAAAA/AAAAAABAAAAAAQAMTAuMTEuNi1NYXJpYURCLWRlYnVnLWxvZwAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAADoQ1tlEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAEEwQADQgICAoKCgGbvv33
';
--disconnect con1
--connect(con1,localhost,root,,)
# The bug was that the THD::rli_fake was not cleared when the THD is re-used
# for the new connection, and we would get a warning from the following
# statement.
SET SESSION pseudo_slave_mode= 1;
--disconnect con1
--connection default
15 changes: 4 additions & 11 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,10 @@ void THD::free_connection()
vio_delete(net.vio);
net.vio= nullptr;
net_end(&net);
delete(rgi_fake);
rgi_fake= NULL;
delete(rli_fake);
rli_fake= NULL;
#endif
if (!cleanup_done)
cleanup();
Expand Down Expand Up @@ -1695,17 +1699,6 @@ THD::~THD()
dbug_sentry= THD_SENTRY_GONE;
#endif
#ifndef EMBEDDED_LIBRARY
if (rgi_fake)
{
delete rgi_fake;
rgi_fake= NULL;
}
if (rli_fake)
{
delete rli_fake;
rli_fake= NULL;
}

if (rgi_slave)
rgi_slave->cleanup_after_session();
my_free(semisync_info);
Expand Down

0 comments on commit d415f60

Please sign in to comment.