Skip to content

Commit 3e50e46

Browse files
committed
Lift restriction on setting read_only_error_msg_extra
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
1 parent 19277b0 commit 3e50e46

11 files changed

+264
-279
lines changed

mysql-test/r/range_all.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
862862
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
863863
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
864864
Warnings:
865-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
866866
drop table t1;
867867
End of 4.1 tests
868868
CREATE TABLE t1 (

mysql-test/r/range_icp.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
862862
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
863863
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
864864
Warnings:
865-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
866866
drop table t1;
867867
End of 4.1 tests
868868
CREATE TABLE t1 (

mysql-test/r/range_icp_mrr.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
862862
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
863863
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
864864
Warnings:
865-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
866866
drop table t1;
867867
End of 4.1 tests
868868
CREATE TABLE t1 (

mysql-test/r/range_mrr.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
862862
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
863863
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
864864
Warnings:
865-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
866866
drop table t1;
867867
End of 4.1 tests
868868
CREATE TABLE t1 (

mysql-test/r/range_mrr_cost.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
862862
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
863863
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
864864
Warnings:
865-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
866866
drop table t1;
867867
End of 4.1 tests
868868
CREATE TABLE t1 (

mysql-test/r/range_none.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
861861
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
862862
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
863863
Warnings:
864-
Warning 1927 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
864+
Warning 1926 Memory capacity of 1536000 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
865865
drop table t1;
866866
End of 4.1 tests
867867
CREATE TABLE t1 (

mysql-test/r/range_with_memory_limit.result

+251-251
Large diffs are not rendered by default.

mysql-test/suite/sys_vars/r/read_only_error_msg_extra_basic.result

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
set @@global.read_only_error_msg_extra='Not in read_only';
2-
ERROR HY000: The system variable read_only_error_msg_extra can only be set in read-only (super) status.
1+
set @@global.read_only_error_msg_extra='Custom message before read_only';
2+
select @@global.read_only_error_msg_extra;
3+
@@global.read_only_error_msg_extra
4+
Custom message before read_only
35
set global read_only = true;
46
set @@global.read_only_error_msg_extra = default;
57
select @@global.read_only_error_msg_extra;

mysql-test/suite/sys_vars/t/read_only_error_msg_extra_basic.test

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
--source include/not_embedded.inc
22

3-
# Cannot set the value if server is not in read_only
4-
--error ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY
5-
set @@global.read_only_error_msg_extra='Not in read_only';
3+
set @@global.read_only_error_msg_extra='Custom message before read_only';
4+
select @@global.read_only_error_msg_extra;
65

76
set global read_only = true;
87
set @@global.read_only_error_msg_extra = default;

sql/share/errmsg-utf8.txt

-3
Original file line numberDiff line numberDiff line change
@@ -7230,9 +7230,6 @@ ER_CONNECTION_TIMEOUT
72307230
ER_OPTION_PREVENTS_STATEMENT_EXTRA_INFO
72317231
eng "The MySQL server is running with the %s option so it cannot execute this statement. %s"
72327232

7233-
ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY
7234-
eng "The system variable %.200s can only be set in read-only (super) status."
7235-
72367233
ER_CAPACITY_EXCEEDED
72377234
eng "Memory capacity of %llu bytes for '%s' exceeded. %s"
72387235

sql/sys_vars.cc

+1-14
Original file line numberDiff line numberDiff line change
@@ -5543,22 +5543,9 @@ static Sys_var_uint Sys_select_into_file_fsync_timeout(
55435543
SESSION_VAR(select_into_file_fsync_timeout), CMD_LINE(OPT_ARG),
55445544
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
55455545

5546-
static bool check_read_only_error_msg_extra(
5547-
sys_var *self, THD *thd, set_var *var)
5548-
{
5549-
if (!opt_readonly && !opt_super_readonly)
5550-
{
5551-
my_error(ER_VARIABLE_NOT_SETTABLE_WITHOUT_READ_ONLY,
5552-
MYF(0),
5553-
var->var->name.str);
5554-
return true;
5555-
}
5556-
return false;
5557-
}
55585546
static Sys_var_charptr Sys_read_only_error_msg_extra(
55595547
"read_only_error_msg_extra",
55605548
"Set this variable to print out extra error information, "
55615549
"which will be appended to read_only error messages.",
55625550
GLOBAL_VAR(opt_read_only_error_msg_extra), CMD_LINE(OPT_ARG),
5563-
IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
5564-
ON_CHECK(check_read_only_error_msg_extra));
5551+
IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG);

0 commit comments

Comments
 (0)