-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SRO + multi-table update statements in replication when logged in…
… statement form. Summary: This was contributed as: #11 This is a bug fix for super-read-only not being ignored for the replication thread on multi-table update statements in sql_parse.cc that would cause replication the stop with the error "Error 'The MySQL server is running with the --read-only (super) option so it cannot execute this statement' on query. Default database: 'test'. Query: 'update t2 natural join t1 set b=3'". The same issue was found in transaction.cc. To help avoid this issue in the future the logic for testing if read-only should be enforced is refactored into a new inline function, and existing code that performed the logic in each location was changed to instead call this function. Test Plan: mtr test Reviewers: steaphan, jtolmer Reviewed By: jtolmer
- Loading branch information
Showing
8 changed files
with
49 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef SQL_READONLY_INCLUDED | ||
#define SQL_READONLY_INCLUDED | ||
|
||
#include "sql_acl.h" /* SUPER_ACL */ | ||
#include "sql_class.h" /* THD class */ | ||
#include "mysqld.h" /* opt_readonly and opt_super_readonly */ | ||
|
||
static inline bool check_ro(THD *thd) | ||
{ | ||
return ( | ||
opt_readonly && ( | ||
!(thd->security_ctx->master_access & SUPER_ACL) || | ||
(opt_super_readonly && !(thd->slave_thread)) | ||
) | ||
); | ||
} | ||
|
||
#endif /* SQL_READONLY_INCLUDED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fd5b0ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slyglif Your fix is now included in the public release. Thanks for the contribution.