Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
-
None
Description
If GRANT (I suppose REVOKE too, and maybe some other statements sharing the same logic) is executed partially but ends with an error, it isn't written into the binlog with an error code as is customary to do. Naturally it makes the data diverge between master and slave, and further replication is bound to abort.
In the test case below, GRANT is called for an existing user foo and non-existing user bar. It is applied to foo on master, but not binary-logged, so it's not applied on the slave. Further operations (e.g. revoking the same grant) would cause replication abort.
--source include/master-slave.inc
|
|
set sql_mode=concat(@@sql_mode,',NO_AUTO_CREATE_USER'); # This is default, but just in case |
|
create user foo; |
|
--error ER_PASSWORD_NO_MATCH
|
grant select on db.* to foo, bar; |
show grants for foo; |
|
# revoke select on db.* from foo; # <= if you want to get actual replication abort |
|
show binlog events;
|
--sync_slave_with_master
|
show grants for foo; |
|
# Cleanup
|
|
--connection master
|
drop user foo; |
--source include/rpl_end.inc |
10.3 9de37e07 |
[connection master] |
set sql_mode=concat(@@sql_mode,',NO_AUTO_CREATE_USER'); |
create user foo; |
grant select on db.* to foo, bar; |
ERROR 28000: Can't find any matching row in the user table |
show grants for foo; |
Grants for foo@% |
GRANT USAGE ON *.* TO `foo`@`%` |
GRANT SELECT ON `db`.* TO `foo`@`%` |
show binlog events;
|
Log_name Pos Event_type Server_id End_log_pos Info
|
master-bin.000001 4 Format_desc 1 256 Server ver: 10.3.37-MariaDB-debug-log, Binlog ver: 4
|
master-bin.000001 256 Gtid_list 1 285 []
|
master-bin.000001 285 Binlog_checkpoint 1 329 master-bin.000001
|
master-bin.000001 329 Gtid 1 371 GTID 0-1-1
|
master-bin.000001 371 Query 1 453 use `test`; create user foo |
connection slave; |
show grants for foo; |
Grants for foo@% |
GRANT USAGE ON *.* TO `foo`@`%` |
connection master; |
Reproducible on all current server versions.