summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-04-26 19:51:42 -0600
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-04-29 17:01:05 -0600
commit960223da39e6e7704b3b0e2de9fda404cc5f8d51 (patch)
tree101c69694eac4ebd4a306131cdadcdf66392bf93 /sql/sql_parse.cc
parent388032e99057449219d4a943b4407e36c42ec4af (diff)
downloadmariadb-git-10.2-MDEV-28294-pre-exec.tar.gz
MDEV-28294: set default role bypasses Replicate_Wild_Ignore_Table: mysql.%10.2-MDEV-28294-pre-exec
Problem: ======== When replicating SET DEFAULT ROLE, the pre-update check (i.e. that in set_var_default_role::check()) tries to validate the existence of the given rules/user even when the targeted tables are ignored. When previously issued CREATE USER/ROLE commands are ignored by the replica because of the replication filtering rules, this results in an error because the targeted data does not exist. Solution: ======== Before checking that the given rules/user exist of a SET DEFAULT ROLE command, first ensure that the mysql.user and mysql.roles_mapping tables are not excluded by replication filters. Reviewed By =========== Andrei Elkin <andrei.elkin@mariadb.com>
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 989ca0c8803..38df31ae16c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3312,6 +3312,38 @@ mysql_execute_command(THD *thd)
MYF(0));
DBUG_RETURN(0);
}
+
+ /*
+ Check if the SET command will modify a table that should be ignored in
+ replication.
+ */
+ if (lex->sql_command == SQLCOM_SET_OPTION)
+ {
+ List<set_var_base> *lex_var_list= &lex->var_list;
+ List_iterator_fast<set_var_base> it(*lex_var_list);
+ set_var_base *set_var;
+ while ((set_var=it++))
+ {
+ TABLE_LIST *tables;
+ set_var->get_modified_tables(&tables);
+ if (tables && all_tables_not_ok(thd, tables))
+ {
+ /*
+ Used in MTR to prove that the event was ignored _here_
+ */
+ DBUG_EXECUTE_IF(
+ "sync_set_var_rpl_filtered",
+ DBUG_ASSERT(!debug_sync_set_action(
+ thd, STRING_WITH_LEN("now SIGNAL ignoring_event WAIT_FOR "
+ "ack_event_ignored"))););
+ /* warn the slave SQL thread */
+ my_message(ER_SLAVE_IGNORED_TABLE,
+ ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0));
+ DBUG_RETURN(0);
+ }
+ }
+ }
+
/*
Execute deferred events first
*/