-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a variable for appending a custom message to server read_only error
Summary: Proposing a way to set a custom message in the `--read-only (super)` error. Note: the variable can only be set when server is in read-only (super) state. p.s. I am hesitant to add a mutex for the variable, so we will get a snapshot of the current pointer of the variable (const char*) when printing the error. Squash with https://reviews.facebook.net/D61383 Test Plan: Added tests. Reviewers: santoshb Reviewed By: santoshb Subscribers: webscalesql-eng, ebergen Differential Revision: https://reviews.facebook.net/D61713
- Loading branch information
Showing
12 changed files
with
107 additions
and
0 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
20 changes: 20 additions & 0 deletions
20
mysql-test/suite/sys_vars/r/read_only_error_msg_extra_basic.result
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,20 @@ | ||
set @@global.read_only_error_msg_extra='Not in read_only'; | ||
ERROR HY000: The system variable read_only_error_msg_extra can only be set in read-only (super) status. | ||
set global read_only = true; | ||
set @@global.read_only_error_msg_extra = default; | ||
select @@global.read_only_error_msg_extra; | ||
@@global.read_only_error_msg_extra | ||
|
||
set @saved_read_only_error_msg_extra = @@global.read_only_error_msg_extra; | ||
set @@global.read_only_error_msg_extra='This is a custom message'; | ||
set global super_read_only = true; | ||
set @@global.read_only_error_msg_extra='This is another custom message'; | ||
set @@global.read_only_error_msg_extra=1; | ||
ERROR 42000: Incorrect argument type to variable 'read_only_error_msg_extra' | ||
select @@session.read_only_error_msg_extra; | ||
ERROR HY000: Variable 'read_only_error_msg_extra' is a GLOBAL variable | ||
set @@session.read_only_error_msg_extra='This is a custom message'; | ||
ERROR HY000: Variable 'read_only_error_msg_extra' is a GLOBAL variable and should be set with SET GLOBAL | ||
set global read_only_error_msg_extra = @saved_read_only_error_msg_extra; | ||
set global super_read_only = false; | ||
set global read_only = false; |
28 changes: 28 additions & 0 deletions
28
mysql-test/suite/sys_vars/t/read_only_error_msg_extra_basic.test
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,28 @@ | ||
--source include/not_embedded.inc | ||
|
||
# Cannot set the value if server is not in read_only | ||
--error ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY | ||
set @@global.read_only_error_msg_extra='Not in read_only'; | ||
|
||
set global read_only = true; | ||
set @@global.read_only_error_msg_extra = default; | ||
select @@global.read_only_error_msg_extra; | ||
set @saved_read_only_error_msg_extra = @@global.read_only_error_msg_extra; | ||
|
||
set @@global.read_only_error_msg_extra='This is a custom message'; | ||
|
||
set global super_read_only = true; | ||
set @@global.read_only_error_msg_extra='This is another custom message'; | ||
|
||
--error ER_WRONG_TYPE_FOR_VAR | ||
set @@global.read_only_error_msg_extra=1; | ||
|
||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
select @@session.read_only_error_msg_extra; | ||
--error ER_GLOBAL_VARIABLE | ||
set @@session.read_only_error_msg_extra='This is a custom message'; | ||
|
||
set global read_only_error_msg_extra = @saved_read_only_error_msg_extra; | ||
|
||
set global super_read_only = false; | ||
set global read_only = false; |
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