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 16:50:57 -0600
commit6080ef0f1739d59e963edf9169cb7ca7b44d8b9c (patch)
treee7420aa9d353101878604fa07b948ca58051ec69 /sql/sql_parse.cc
parentc8228369f6dad5cfd17c5a9d9ea1c5c3ecd30fe7 (diff)
downloadmariadb-git-bb-10.4-MDEV-28294-merge.tar.gz
MDEV-28294: set default role bypasses Replicate_Wild_Ignore_Table: mysql.%bb-10.4-MDEV-28294-merge
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.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6a1b849b912..2b718972fc6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3661,6 +3661,39 @@ 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
*/