Skip to content

Commit 0285547

Browse files
marcalffbjornmu
authored andcommitted
Bug#20575529 PERFORMANCE_SCHEMA.GLOBAL_VARIABLES MYSTERY DEPRECATION
WARNING The following query SELECT * from performance_schema.global_variables; displays a deprecation warning related to the global variable 'sql_log_bin', because of special logic implemented for this very variable for backward compatibility reasons. See the resolution of Bug#67433 Using SET GLOBAL SQL_LOG_BIN should not be allowed for details. This fix filters out explicitly variable 'sql_log_bin' from table performance_schema.global_variables because: - this variable is not intended to be global, - there is no need to preserve backward compatibility for this table since it is new, unlike the existing table INFORMATION_SCHEMA.global_variables. (cherry picked from commit 56f6154ed5ae5cb51f658000d4af2725d2129f55)
1 parent dbe3bd6 commit 0285547

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

mysql-test/suite/perfschema/r/show_sanity.result

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ Warning 1287 'INFORMATION_SCHEMA.SESSION_VARIABLES' is deprecated and will be re
123123
insert into test.sanity
124124
select "5.7", "P_S.GLOBAL_VARIABLES", variable_name
125125
from performance_schema.global_variables;
126-
Warnings:
127-
Warning 1287 '@@global.sql_log_bin' is deprecated and will be removed in a future release. Please use the constant 1 (since @@global.sql_log_bin is always equal to 1) instead
128126

129127
# STEP 2-4
130128
insert into test.sanity
@@ -283,6 +281,7 @@ where show_mode = "5.7"
283281
and source = "P_S.GLOBAL_VARIABLES")
284282
order by show_mode, source, variable_name;
285283
SHOW_MODE SOURCE VARIABLE_NAME
284+
5.6 I_S.GLOBAL_VARIABLES SQL_LOG_BIN
286285

287286
================================================================================
288287
TEST 3

storage/perfschema/pfs_variable.cc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,40 @@ int PFS_system_variable_cache::do_materialize_global(void)
120120
for (Show_var_array::iterator show_var= m_show_var_array.begin();
121121
show_var->value && (show_var != m_show_var_array.end()); show_var++)
122122
{
123+
const char* name= show_var->name;
123124
sys_var *value= (sys_var *)show_var->value;
124125
DBUG_ASSERT(value);
125126

127+
if ((m_query_scope == OPT_GLOBAL) &&
128+
(!my_strcasecmp(system_charset_info, name, "sql_log_bin")))
129+
{
130+
/*
131+
PLEASE READ:
132+
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-6.html
133+
134+
SQL_LOG_BIN is:
135+
- declared in sys_vars.cc as both GLOBAL and SESSION in 5.7
136+
- impossible to SET with SET GLOBAL (raises an error)
137+
- and yet can be read with @@global.sql_log_bin
138+
139+
When show_compatibility_56 = ON,
140+
- SHOW GLOBAL VARIABLES does expose a row for SQL_LOG_BIN
141+
- INFORMATION_SCHEMA.GLOBAL_VARIABLES also does expose a row,
142+
both are for backward compatibility of existing applications,
143+
so that no application logic change is required.
144+
145+
Now, with show_compatibility_56 = OFF (aka, in this code)
146+
- SHOW GLOBAL VARIABLES does -- not -- expose a row for SQL_LOG_BIN
147+
- PERFORMANCE_SCHEMA.GLOBAL_VARIABLES also does -- not -- expose a row
148+
so that a clean interface is exposed to (upgraded and modified) applications.
149+
150+
The assert below will fail once SQL_LOG_BIN really is defined
151+
as SESSION_ONLY (in 5.8), so that this special case can be removed.
152+
*/
153+
DBUG_ASSERT(value->scope() == sys_var::SESSION);
154+
continue;
155+
}
156+
126157
/* Match the system variable scope to the target scope. */
127158
if (match_scope(value->scope()))
128159
{

0 commit comments

Comments
 (0)