summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-05-10 14:25:35 -0600
committerAndrei <andrei.elkin@mariadb.com>2022-09-03 13:04:44 +0300
commit47812017c67f1cba46cbc9dceee4c613a00dfd94 (patch)
tree07232f9a5914bfa26c47bb64f6c2587e53c7fe0c /sql/sql_acl.cc
parente4cffc92c783b0d0be35fa2e696ed517b381f81f (diff)
downloadmariadb-git-47812017c67f1cba46cbc9dceee4c613a00dfd94.tar.gz
MDEV-28530: Revoking privileges from a non-existing user on a master breaks replication on the slave in the presence of replication filters
Problem: ======== Replication can break while applying a query log event if its respective command errors on the primary, but is ignored by the replication filter within Grant_tables on the replica. The bug reported by MDEV-28530 shows this with REVOKE ALL PRIVILEGES using a non-existent user. The primary will binlog the REVOKE command with an error code, and the replica will think the command executed with success because the replication filter will ignore the command while accessing the Grant_tables classes. When the replica performs an error check, it sees the difference between the error codes, and replication breaks. Solution: ======== If the replication filter check done by Grant_tables logic ignores the tables, reset thd->slave_expected_error to 0 so that Query_log_event::do_apply_event() can be made aware that the underlying query was ignored when it compares errors. Note that this bug also effects DROP USER if not all users exist in the provided list, and the patch fixes and tests this case. Reviewed By: ============ andrei.elkin@mariadb.com
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 930c107cde2..eae180837ae 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1300,7 +1300,10 @@ class Grant_tables
Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;
if (rpl_filter->is_on() &&
!rpl_filter->tables_ok(0, &first_table_in_list->tl))
+ {
+ thd->slave_expected_error= 0;
DBUG_RETURN(1);
+ }
}
DBUG_RETURN(0);
}