Bug #106942 | alter user may lead replication broken with error 1396 | ||
---|---|---|---|
Submitted: | 7 Apr 2022 10:44 | Modified: | 19 Apr 2022 9:40 |
Reporter: | dennis GAO (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 8.0.28 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution |
[7 Apr 2022 10:44]
dennis GAO
[7 Apr 2022 11:13]
dennis GAO
Cause the alter user command may invoke the reload_acl_caches if it execute fail, so it is better to invoke the reload_acl_cache (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: alter_user_1396.diff (text/x-patch), 2.69 KiB.
[7 Apr 2022 12:49]
MySQL Verification Team
Hello dennis GAO, Thank you for the report and contribution. regards, Umesh
[8 Apr 2022 8:23]
huahua xu
Hi dennis GAO, I don't think your suggested fix is the best, which may affect the performance. You can study the implementation of mysql 5.7, and will have a better idea.
[15 Apr 2022 3:28]
dennis GAO
Hi huahua xu, Thanks for the suggestion. In 5.7 the acl_end_trans_and_close_tables will only check thd->transaction_rollback_request and rollback_whole_statement to decide whether do the acl reload. But in 8.0, the acl_end_trans_and_close_tables will also check thd->is_error(), which in some case really need to restore correct state of in-memory structures by reloading privileges. Cause the alter user command may still need do the acl reload in some cases, I prefer to always do the acl reload at the beginning. So the behavior of alter user can be more predicatable
[19 Apr 2022 9:40]
Georgi Kodinov
Posted by developer: Manual updates to system tables using DML statements should be avoided. Exactly for the reason of the ACL cache and the persisted values going out of sync. When it absolutely must be done a *MANUAL* FLUSH PRIVILEGES should be executed (and binlogged) on all affected mysqlds. Even with that, we try to fix the bugs that can cause server crashes etc. But since there's no crash here, closing as "won't fix".