Skip to content

Commit 02b81af

Browse files
committed
cleanup: THD::change_user
1 parent fa47c73 commit 02b81af

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

sql/sql_class.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,14 @@ void THD::init_for_queries()
15461546

15471547
void THD::change_user(void)
15481548
{
1549+
#ifdef WITH_WSREP
1550+
bool pause_wsrep= wsrep_cs().state() != wsrep::client_state::s_none;
1551+
if (pause_wsrep)
1552+
{
1553+
wsrep_after_command_ignore_result(this);
1554+
wsrep_close(this);
1555+
}
1556+
#endif /* WITH_WSREP */
15491557
if (!status_in_global) // Reset in init()
15501558
add_status_to_global();
15511559

@@ -1575,6 +1583,13 @@ void THD::change_user(void)
15751583
sp_caches_clear();
15761584
statement_rcontext_reinit();
15771585
opt_trace.delete_traces();
1586+
#ifdef WITH_WSREP
1587+
if (pause_wsrep)
1588+
{
1589+
wsrep_open(this);
1590+
wsrep_before_command(this);
1591+
}
1592+
#endif /* WITH_WSREP */
15781593
}
15791594

15801595
/**

sql/sql_parse.cc

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,22 +1713,8 @@ dispatch_command_return dispatch_command(enum enum_server_command command, THD *
17131713
case COM_RESET_CONNECTION:
17141714
{
17151715
thd->status_var.com_other++;
1716-
#ifdef WITH_WSREP
1717-
if (unlikely(wsrep_service_started))
1718-
{
1719-
wsrep_after_command_ignore_result(thd);
1720-
wsrep_close(thd);
1721-
}
1722-
#endif /* WITH_WSREP */
17231716
thd->change_user();
17241717
thd->clear_error(); // if errors from rollback
1725-
#ifdef WITH_WSREP
1726-
if (unlikely(wsrep_service_started))
1727-
{
1728-
wsrep_open(thd);
1729-
wsrep_before_command(thd);
1730-
}
1731-
#endif /* WITH_WSREP */
17321718
/* Restore original charset from client authentication packet.*/
17331719
if(thd->org_charset)
17341720
thd->update_charset(thd->org_charset,thd->org_charset,thd->org_charset);
@@ -1740,21 +1726,7 @@ dispatch_command_return dispatch_command(enum enum_server_command command, THD *
17401726
int auth_rc;
17411727
status_var_increment(thd->status_var.com_other);
17421728

1743-
#ifdef WITH_WSREP
1744-
if (unlikely(wsrep_service_started))
1745-
{
1746-
wsrep_after_command_ignore_result(thd);
1747-
wsrep_close(thd);
1748-
}
1749-
#endif /* WITH_WSREP */
17501729
thd->change_user();
1751-
#ifdef WITH_WSREP
1752-
if (unlikely(wsrep_service_started))
1753-
{
1754-
wsrep_open(thd);
1755-
wsrep_before_command(thd);
1756-
}
1757-
#endif /* WITH_WSREP */
17581730
thd->clear_error(); // if errors from rollback
17591731

17601732
/* acl_authenticate() takes the data from net->read_pos */

0 commit comments

Comments
 (0)