Skip to content

Commit

Permalink
Lift restriction on setting read_only_error_msg_extra
Browse files Browse the repository at this point in the history
Summary:
Per request, we allow setting read_only_error_msg_extra without being in
read_only state. The custom message can be set/reset at any time.

Squash with https://reviews.facebook.net/D61713
Squash with https://reviews.facebook.net/D61677 (for main.range* test results)

Test Plan: mtr

Reviewers: santoshb

Reviewed By: santoshb

Subscribers: webscalesql-eng

Differential Revision: https://reviews.facebook.net/D64125
  • Loading branch information
tianx committed Sep 19, 2016
1 parent 19277b0 commit 3e50e46
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 279 deletions.
2 changes: 1 addition & 1 deletion mysql-test/r/range_all.result
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/range_icp.result
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/range_icp_mrr.result
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/range_mrr.result
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/range_mrr_cost.result
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/range_none.result
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
Warnings:
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
Expand Down
502 changes: 251 additions & 251 deletions mysql-test/r/range_with_memory_limit.result

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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_error_msg_extra='Custom message before read_only';
select @@global.read_only_error_msg_extra;
@@global.read_only_error_msg_extra
Custom message before read_only
set global read_only = true;
set @@global.read_only_error_msg_extra = default;
select @@global.read_only_error_msg_extra;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
--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_error_msg_extra='Custom message before read_only';
select @@global.read_only_error_msg_extra;

set global read_only = true;
set @@global.read_only_error_msg_extra = default;
Expand Down
3 changes: 0 additions & 3 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7230,9 +7230,6 @@ ER_CONNECTION_TIMEOUT
ER_OPTION_PREVENTS_STATEMENT_EXTRA_INFO
eng "The MySQL server is running with the %s option so it cannot execute this statement. %s"

ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY
eng "The system variable %.200s can only be set in read-only (super) status."

ER_CAPACITY_EXCEEDED
eng "Memory capacity of %llu bytes for '%s' exceeded. %s"

Expand Down
15 changes: 1 addition & 14 deletions sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5543,22 +5543,9 @@ static Sys_var_uint Sys_select_into_file_fsync_timeout(
SESSION_VAR(select_into_file_fsync_timeout), CMD_LINE(OPT_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));

static bool check_read_only_error_msg_extra(
sys_var *self, THD *thd, set_var *var)
{
if (!opt_readonly && !opt_super_readonly)
{
my_error(ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY,
MYF(0),
var->var->name.str);
return true;
}
return false;
}
static Sys_var_charptr Sys_read_only_error_msg_extra(
"read_only_error_msg_extra",
"Set this variable to print out extra error information, "
"which will be appended to read_only error messages.",
GLOBAL_VAR(opt_read_only_error_msg_extra), CMD_LINE(OPT_ARG),
IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_read_only_error_msg_extra));
IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG);

0 comments on commit 3e50e46

Please sign in to comment.