MXS-2713 Classify SET PASSWORD as QUERY_TYPE_WRITE

A change of the password is replicated to the slaves, so it
must only be sent to the master.
This commit is contained in:
Johan Wikman
2019-10-07 14:33:53 +03:00
parent 2a7f320cf4
commit e7e40b0179
5 changed files with 42 additions and 18 deletions

View File

@ -854,31 +854,41 @@ static uint32_t resolve_query_type(parsing_info_t* pi, THD* thd)
*/
else if (lex->sql_command == SQLCOM_SET_OPTION)
{
type |= QUERY_TYPE_SESSION_WRITE;
if (get_set_type(pi->pi_query_plain_str) == SET_TYPE_UNKNOWN)
switch (get_set_type(pi->pi_query_plain_str))
{
/** Either user- or system variable write */
List_iterator<set_var_base> ilist(lex->var_list);
size_t n = 0;
case SET_TYPE_PASSWORD:
type |= QUERY_TYPE_WRITE;
break;
while (set_var_base* var = ilist++)
case SET_TYPE_UNKNOWN:
{
if (var->is_system())
type |= QUERY_TYPE_SESSION_WRITE;
/** Either user- or system variable write */
List_iterator<set_var_base> ilist(lex->var_list);
size_t n = 0;
while (set_var_base* var = ilist++)
{
if (var->is_system())
{
type |= QUERY_TYPE_GSYSVAR_WRITE;
}
else
{
type |= QUERY_TYPE_USERVAR_WRITE;
}
++n;
}
if (n == 0)
{
type |= QUERY_TYPE_GSYSVAR_WRITE;
}
else
{
type |= QUERY_TYPE_USERVAR_WRITE;
}
++n;
}
break;
if (n == 0)
{
type |= QUERY_TYPE_GSYSVAR_WRITE;
}
default:
type |= QUERY_TYPE_SESSION_WRITE;
}
}
else