Commit 3fb68b5f authored by Ingo Struewing's avatar Ingo Struewing

merge

parents a8d3f032 cff0a6b6
** Setup **
** Connecting con0 using root **
** Connecting con1 using root **
'#-----------------------------FN_DYNVARS_179_01------------------#'
** Connection con0 **
SET @ts_old = @@SESSION.timestamp;
waiting 1 sec
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
Timestamp Difference
SELECT date(now()) = date(sysdate());
date(now()) = date(sysdate())
1
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
1
** Connecting con0 using root **
SELECT @@session.timestamp != 1100000000;
@@session.timestamp != 1100000000
1
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
1
1 means >=1 expected is true
** Connection con1 **
SET @ts_old = @@SESSION.timestamp;
waiting 4 sec
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 4 AS 'Timestamp Difference';
Timestamp Difference
SELECT @@session.timestamp != 1000000000;
@@session.timestamp != 1000000000
1
1 means >=4 expected is true
'#-----------------------------FN_DYNVARS_179_02---------------------#'
SET @ts_old = @@SESSION.timestamp;
Changing time zone
SET time_zone = 'MET';
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
Timestamp Difference
SELECT @@session.timestamp = 1100000000;
@@session.timestamp = 1100000000
1
1 means >=1 expected is true
** Cleanup **
** Connection default **
Disconnecting Connections con0, con1
** Connecting con1 using root **
SELECT date(now()) = date(sysdate());
date(now()) = date(sysdate())
1
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
0
** Connecting con0 using root **
SELECT @@session.timestamp != 1100000000;
@@session.timestamp != 1100000000
1
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
0
** Connection con1 **
SELECT @@session.timestamp != 1000000000;
@@session.timestamp != 1000000000
1
SELECT @@session.timestamp = 1100000000;
@@session.timestamp = 1100000000
1
** Connection default **
Disconnecting Connections con0, con1
......@@ -15,3 +15,95 @@ slave_skip_errors 3,100,137,643,1752
---- Clean Up ----
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
#
SHOW VARIABLES like 'log_slave_updates';
Variable_name Value
log_slave_updates OFF
SELECT @@session.log_slave_updates;
ERROR HY000: Variable 'log_slave_updates' is a GLOBAL variable
SELECT @@global.log_slave_updates;
@@global.log_slave_updates
0
SET @@session.log_slave_updates= true;
ERROR HY000: Variable 'log_slave_updates' is a read only variable
SET @@global.log_slave_updates= true;
ERROR HY000: Variable 'log_slave_updates' is a read only variable
#
SHOW VARIABLES like 'relay_log';
Variable_name Value
relay_log
SELECT @@session.relay_log;
ERROR HY000: Variable 'relay_log' is a GLOBAL variable
SELECT @@global.relay_log;
@@global.relay_log
NULL
SET @@session.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
SET @@global.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
#
SHOW VARIABLES like 'relay_log_index';
Variable_name Value
relay_log_index
SELECT @@session.relay_log_index;
ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
SELECT @@global.relay_log_index;
@@global.relay_log_index
NULL
SET @@session.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
SET @@global.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
#
SHOW VARIABLES like 'relay_log_info_file';
Variable_name Value
relay_log_info_file relay-log.info
SELECT @@session.relay_log_info_file;
ERROR HY000: Variable 'relay_log_info_file' is a GLOBAL variable
SELECT @@global.relay_log_info_file;
@@global.relay_log_info_file
relay-log.info
SET @@session.relay_log_info_file= 'x';
ERROR HY000: Variable 'relay_log_info_file' is a read only variable
SET @@global.relay_log_info_file= 'x';
ERROR HY000: Variable 'relay_log_info_file' is a read only variable
#
SHOW VARIABLES like 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
SELECT @@session.relay_log_space_limit;
ERROR HY000: Variable 'relay_log_space_limit' is a GLOBAL variable
SELECT @@global.relay_log_space_limit;
@@global.relay_log_space_limit
0
SET @@session.relay_log_space_limit= 7;
ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
SET @@global.relay_log_space_limit= 7;
ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
#
SHOW VARIABLES like 'slave_load_tmpdir';
Variable_name Value
slave_load_tmpdir #
SELECT @@session.slave_load_tmpdir;
ERROR HY000: Variable 'slave_load_tmpdir' is a GLOBAL variable
SELECT @@global.slave_load_tmpdir;
@@global.slave_load_tmpdir
#
SET @@session.slave_load_tmpdir= 'x';
ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
SET @@global.slave_load_tmpdir= 'x';
ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
#
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
SELECT @@session.slave_skip_errors;
ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
SELECT @@global.slave_skip_errors;
@@global.slave_skip_errors
3,100,137,643,1752
SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
This diff is collapsed.
......@@ -9,6 +9,8 @@
# Creation Date: 2008-02-25 #
# Author: Sharique Abdullah #
# #
# Modified: HHunger 2008-08-28 Reimplemented the test completely. #
# #
# Description: Test Cases of Dynamic System Variable "timestamp" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
......@@ -17,63 +19,32 @@
# #
############################################################################
--echo ** Setup **
--echo
#
# Setup
#
--echo ** Connecting con0 using root **
connect (con0,localhost,root,,);
--echo ** Connecting con1 using root **
connect (con1, localhost, root,,);
--echo '#-----------------------------FN_DYNVARS_179_01------------------#'
#
# Checking for connection 1
#
# Change timestamp which must have an effect on now(), but not on sysdate().
# Use Unix epoch timestamp
# All comparisons must deliver true(1)
# Exception: --sysdate-is-now switches off this behaviour and must not be set.
--echo ** Connection con0 **
connection con0;
SET @ts_old = @@SESSION.timestamp;
--echo waiting 1 sec
--sleep 1
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
--echo 1 means >=1 expected is true
--echo ** Connecting con1 using root **
connect (con1,localhost,root,,);
SELECT date(now()) = date(sysdate());
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
# Assure that setting of the variable has no effect on other session.
--echo ** Connecting con0 using root **
connect (con0,localhost,root,,);
SELECT @@session.timestamp != 1100000000;
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
#
# Checking for connection 2
#
--echo ** Connection con1 **
connection con1;
SET @ts_old = @@SESSION.timestamp;
--echo waiting 4 sec
--sleep 4
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 4 AS 'Timestamp Difference';
--echo 1 means >=4 expected is true
--echo '#-----------------------------FN_DYNVARS_179_02---------------------#'
#
# Testing timezone change effect
#
SET @ts_old = @@SESSION.timestamp;
--sleep 1
--echo Changing time zone
SET time_zone = 'MET';
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
--echo 1 means >=1 expected is true
#
# Cleanup
#
--echo ** Cleanup **
SELECT @@session.timestamp != 1000000000;
SELECT @@session.timestamp = 1100000000;
--echo ** Connection default **
connection default;
--echo Disconnecting Connections con0, con1
disconnect con0;
disconnect con1;
############################################################################
# #
# Variable Name: timestamp with sysdate-is-now #
# Scope: GLOBAL #
# Access Type: Dynamic #
# Data Type: INTEGER #
# #
# #
# Creation Date: 2008-11-25 #
# Author: Horst Hunger #
# #
# Description: Test Cases of Dynamic System Variable "timestamp" #
# that checks behavior of this variable in the following ways #
# * Like timstamp_func, but with set "sysdate-is-now". #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
# #
############################################################################
# Use Unix epoch timestamp
# Due to "--sysdate-is-now" timestamp must have an effect on both.
# See also timestamp_func.test.
--echo ** Connecting con1 using root **
connect (con1,localhost,root,,);
SELECT date(now()) = date(sysdate());
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
# Assure that setting of the variable has no effect on other session.
--echo ** Connecting con0 using root **
connect (con0,localhost,root,,);
SELECT @@session.timestamp != 1100000000;
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
--echo ** Connection con1 **
connection con1;
SELECT @@session.timestamp != 1000000000;
SELECT @@session.timestamp = 1100000000;
--echo ** Connection default **
connection default;
--echo Disconnecting Connections con0, con1
disconnect con0;
disconnect con1;
......@@ -28,3 +28,83 @@ set global slave_net_timeout=default;
# sql_slave_skip_counter is write-only, so we can't save previous
# value and restore it here. That's ok, because it's normally 0.
set global sql_slave_skip_counter= 0;
#
# Bug#28234 - global/session scope - documentation vs implementation
#
--echo
#
# Additional variables fixed from sql_repl.cc.
#
--echo #
SHOW VARIABLES like 'log_slave_updates';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.log_slave_updates;
SELECT @@global.log_slave_updates;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.log_slave_updates= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.log_slave_updates= true;
#
--echo #
SHOW VARIABLES like 'relay_log';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log;
SELECT @@global.relay_log;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.relay_log= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.relay_log= 'x';
#
--echo #
SHOW VARIABLES like 'relay_log_index';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log_index;
SELECT @@global.relay_log_index;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.relay_log_index= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.relay_log_index= 'x';
#
--echo #
SHOW VARIABLES like 'relay_log_info_file';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log_info_file;
SELECT @@global.relay_log_info_file;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.relay_log_info_file= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.relay_log_info_file= 'x';
#
--echo #
SHOW VARIABLES like 'relay_log_space_limit';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.relay_log_space_limit;
SELECT @@global.relay_log_space_limit;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.relay_log_space_limit= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.relay_log_space_limit= 7;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'slave_load_tmpdir';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.slave_load_tmpdir;
--replace_column 1 #
SELECT @@global.slave_load_tmpdir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.slave_load_tmpdir= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.slave_load_tmpdir= 'x';
#
--echo #
SHOW VARIABLES like 'slave_skip_errors';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.slave_skip_errors;
SELECT @@global.slave_skip_errors;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.slave_skip_errors= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.slave_skip_errors= 7;
#
......@@ -793,3 +793,299 @@ SET GLOBAL log_output = 0;
--echo
--echo # -- End of Bug#34820.
#
# Bug#28234 - global/session scope - documentation vs implementation
#
--echo
--echo #
SHOW VARIABLES like 'ft_max_word_len';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.ft_max_word_len;
SELECT @@global.ft_max_word_len;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.ft_max_word_len= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.ft_max_word_len= 7;
#
--echo #
SHOW VARIABLES like 'ft_min_word_len';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.ft_min_word_len;
SELECT @@global.ft_min_word_len;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.ft_min_word_len= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.ft_min_word_len= 7;
#
--echo #
SHOW VARIABLES like 'ft_query_expansion_limit';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.ft_query_expansion_limit;
SELECT @@global.ft_query_expansion_limit;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.ft_query_expansion_limit= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.ft_query_expansion_limit= 7;
#
--echo #
SHOW VARIABLES like 'ft_stopword_file';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.ft_stopword_file;
SELECT @@global.ft_stopword_file;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.ft_stopword_file= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.ft_stopword_file= 'x';
#
# Additional variables fixed.
#
--echo #
SHOW VARIABLES like 'back_log';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.back_log;
SELECT @@global.back_log;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.back_log= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.back_log= 7;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'large_files_support';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.large_files_support;
--replace_column 1 #
SELECT @@global.large_files_support;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.large_files_support= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.large_files_support= true;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'character_sets_dir';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.character_sets_dir;
--replace_column 1 #
SELECT @@global.character_sets_dir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.character_sets_dir= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.character_sets_dir= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'init_file';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.init_file;
--replace_column 1 #
SELECT @@global.init_file;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.init_file= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.init_file= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'language';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.language;
--replace_column 1 #
SELECT @@global.language;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.language= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.language= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'large_page_size';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.large_page_size;
--replace_column 1 #
SELECT @@global.large_page_size;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.large_page_size= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.large_page_size= 7;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'large_pages';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.large_pages;
--replace_column 1 #
SELECT @@global.large_pages;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.large_pages= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.large_pages= true;
#
--echo #
SHOW VARIABLES like 'log_bin';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.log_bin;
SELECT @@global.log_bin;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.log_bin= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.log_bin= true;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'log_error';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.log_error;
--replace_column 1 #
SELECT @@global.log_error;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.log_error= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.log_error= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'lower_case_file_system';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.lower_case_file_system;
--replace_column 1 #
SELECT @@global.lower_case_file_system;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.lower_case_file_system= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.lower_case_file_system= true;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'lower_case_table_names';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.lower_case_table_names;
--replace_column 1 #
SELECT @@global.lower_case_table_names;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.lower_case_table_names= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.lower_case_table_names= 7;
#
--echo #
SHOW VARIABLES like 'myisam_recover_options';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.myisam_recover_options;
SELECT @@global.myisam_recover_options;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.myisam_recover_options= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.myisam_recover_options= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'open_files_limit';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.open_files_limit;
--replace_column 1 #
SELECT @@global.open_files_limit;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.open_files_limit= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.open_files_limit= 7;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'pid_file';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.pid_file;
--replace_column 1 #
SELECT @@global.pid_file;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.pid_file= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.pid_file= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'plugin_dir';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.plugin_dir;
--replace_column 1 #
SELECT @@global.plugin_dir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.plugin_dir= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.plugin_dir= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'port';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.port;
--replace_column 1 #
SELECT @@global.port;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.port= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.port= 7;
#
--echo #
SHOW VARIABLES like 'protocol_version';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.protocol_version;
SELECT @@global.protocol_version;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.protocol_version= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.protocol_version= 7;
#
--echo #
SHOW VARIABLES like 'skip_external_locking';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.skip_external_locking;
SELECT @@global.skip_external_locking;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.skip_external_locking= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.skip_external_locking= true;
#
--echo #
SHOW VARIABLES like 'skip_networking';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.skip_networking;
SELECT @@global.skip_networking;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.skip_networking= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.skip_networking= true;
#
--echo #
SHOW VARIABLES like 'skip_show_database';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.skip_show_database;
SELECT @@global.skip_show_database;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.skip_show_database= true;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.skip_show_database= true;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'socket';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.socket;
--replace_column 1 #
SELECT @@global.socket;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.socket= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.socket= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'thread_stack';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.thread_stack;
--replace_column 1 #
SELECT @@global.thread_stack;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.thread_stack= 7;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.thread_stack= 7;
#
......@@ -4855,6 +4855,7 @@ void Item_func_get_system_var::fix_length_and_dec()
max_length= MAX_BLOB_WIDTH;
decimals=NOT_FIXED_DEC;
break;
case SHOW_BOOL:
case SHOW_MY_BOOL:
unsigned_flag= FALSE;
max_length= 1;
......@@ -4882,6 +4883,7 @@ enum Item_result Item_func_get_system_var::result_type() const
{
switch (var->show_type())
{
case SHOW_BOOL:
case SHOW_MY_BOOL:
case SHOW_INT:
case SHOW_LONG:
......@@ -4904,6 +4906,7 @@ enum_field_types Item_func_get_system_var::field_type() const
{
switch (var->show_type())
{
case SHOW_BOOL:
case SHOW_MY_BOOL:
case SHOW_INT:
case SHOW_LONG:
......@@ -4922,6 +4925,10 @@ enum_field_types Item_func_get_system_var::field_type() const
}
/*
Uses var, var_type, component, cache_present, used_query_id, thd,
cached_llval, null_value, cached_null_value
*/
#define get_sys_var_safe(type) \
do { \
type value; \
......@@ -4975,6 +4982,7 @@ longlong Item_func_get_system_var::val_int()
case SHOW_LONG: get_sys_var_safe (ulong);
case SHOW_LONGLONG: get_sys_var_safe (longlong);
case SHOW_HA_ROWS: get_sys_var_safe (ha_rows);
case SHOW_BOOL: get_sys_var_safe (bool);
case SHOW_MY_BOOL: get_sys_var_safe (my_bool);
case SHOW_DOUBLE:
{
......@@ -5072,6 +5080,7 @@ String* Item_func_get_system_var::val_str(String* str)
case SHOW_LONG:
case SHOW_LONGLONG:
case SHOW_HA_ROWS:
case SHOW_BOOL:
case SHOW_MY_BOOL:
str->set (val_int(), collation.collation);
break;
......@@ -5164,6 +5173,7 @@ double Item_func_get_system_var::val_real()
case SHOW_LONG:
case SHOW_LONGLONG:
case SHOW_HA_ROWS:
case SHOW_BOOL:
case SHOW_MY_BOOL:
cached_dval= (double) val_int();
cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
......
This diff is collapsed.
......@@ -929,6 +929,34 @@ public:
};
/**
Global-only, read-only variable. E.g. command line option.
*/
class sys_var_const: public sys_var
{
public:
enum_var_type var_type;
SHOW_TYPE show_type_value;
uchar *ptr;
sys_var_const(sys_var_chain *chain, const char *name_arg, enum_var_type type,
SHOW_TYPE show_type_arg, uchar *ptr_arg)
:sys_var(name_arg), var_type(type),
show_type_value(show_type_arg), ptr(ptr_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
bool check_type(enum_var_type type) { return type != var_type; }
bool check_update_type(Item_result type) { return 1; }
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return ptr;
}
SHOW_TYPE show_type() { return show_type_value; }
bool is_readonly() const { return 1; }
};
class sys_var_have_option: public sys_var
{
protected:
......@@ -1317,7 +1345,6 @@ struct sys_var_with_base
int set_var_init();
void set_var_free();
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
int mysql_del_sys_var_chain(sys_var *chain);
......
......@@ -49,6 +49,7 @@
#define MAX_SLAVE_RETRY_PAUSE 5
bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
typedef bool (*CHECK_KILLED_FUNC)(THD*,void*);
......@@ -275,6 +276,64 @@ err:
}
/**
Convert slave skip errors bitmap into a printable string.
*/
static void print_slave_skip_errors(void)
{
/*
To be safe, we want 10 characters of room in the buffer for a number
plus terminators. Also, we need some space for constant strings.
10 characters must be sufficient for a number plus {',' | '...'}
plus a NUL terminator. That is a max 6 digit number.
*/
const int MIN_ROOM= 10;
DBUG_ENTER("print_slave_skip_errors");
DBUG_ASSERT(sizeof(slave_skip_error_names) > MIN_ROOM);
DBUG_ASSERT(MAX_SLAVE_ERROR <= 999999); // 6 digits
if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
{
/* purecov: begin tested */
memcpy(slave_skip_error_names, STRING_WITH_LEN("OFF"));
/* purecov: end */
}
else if (bitmap_is_set_all(&slave_error_mask))
{
/* purecov: begin tested */
memcpy(slave_skip_error_names, STRING_WITH_LEN("ALL"));
/* purecov: end */
}
else
{
char *buff= slave_skip_error_names;
char *bend= buff + sizeof(slave_skip_error_names);
int errnum;
for (errnum= 1; errnum < MAX_SLAVE_ERROR; errnum++)
{
if (bitmap_is_set(&slave_error_mask, errnum))
{
if (buff + MIN_ROOM >= bend)
break; /* purecov: tested */
buff= int10_to_str(errnum, buff, 10);
*buff++= ',';
}
}
if (buff != slave_skip_error_names)
buff--; // Remove last ','
if (errnum < MAX_SLAVE_ERROR)
{
/* Couldn't show all errors */
buff= strmov(buff, "..."); /* purecov: tested */
}
*buff=0;
}
DBUG_PRINT("init", ("error_names: '%s'", slave_skip_error_names));
DBUG_VOID_RETURN;
}
/*
Init function to set up array for errors that should be skipped for slave
......@@ -314,6 +373,8 @@ void init_slave_skip_errors(const char* arg)
while (!my_isdigit(system_charset_info,*p) && *p)
p++;
}
/* Convert slave skip errors bitmap into a printable string. */
print_slave_skip_errors();
DBUG_VOID_RETURN;
}
......
......@@ -98,6 +98,7 @@ class Master_info;
extern ulong master_retry_count;
extern MY_BITMAP slave_error_mask;
extern char slave_skip_error_names[];
extern bool use_slave_mask;
extern char *slave_load_tmpdir;
extern char *master_info_file, *relay_log_info_file;
......
......@@ -1660,64 +1660,38 @@ public:
static sys_var_chain vars = { NULL, NULL };
static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates",
OPT_GLOBAL, SHOW_MY_BOOL,
(uchar*) &opt_log_slave_updates);
static sys_var_const sys_relay_log(&vars, "relay_log",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &opt_relay_logname);
static sys_var_const sys_relay_log_index(&vars, "relay_log_index",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &opt_relaylog_index_name);
static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &relay_log_info_file);
static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge",
&relay_log_purge);
static sys_var_const sys_relay_log_space_limit(&vars,
"relay_log_space_limit",
OPT_GLOBAL, SHOW_LONGLONG,
(uchar*)
&relay_log_space_limit);
static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &slave_load_tmpdir);
static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout",
&slave_net_timeout);
static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) slave_skip_error_names);
static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries",
&slave_trans_retries);
static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period);
static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter");
static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
static SHOW_VAR fixed_vars[]= {
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
{"relay_log" , (char*) &opt_relay_logname, SHOW_CHAR_PTR},
{"relay_log_index", (char*) &opt_relaylog_index_name, SHOW_CHAR_PTR},
{"relay_log_info_file", (char*) &relay_log_info_file, SHOW_CHAR_PTR},
{"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
{"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
{"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
};
static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
{
var->type=SHOW_CHAR;
var->value= buff;
if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
{
var->value= const_cast<char *>("OFF");
}
else if (bitmap_is_set_all(&slave_error_mask))
{
var->value= const_cast<char *>("ALL");
}
else
{
/* 10 is enough assuming errors are max 4 digits */
int i;
var->value= buff;
for (i= 1;
i < MAX_SLAVE_ERROR &&
(buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
i++)
{
if (bitmap_is_set(&slave_error_mask, i))
{
buff= int10_to_str(i, buff, 10);
*buff++= ',';
}
}
if (var->value != buff)
buff--; // Remove last ','
if (i < MAX_SLAVE_ERROR)
buff= strmov(buff, "..."); // Couldn't show all errors
*buff=0;
}
return 0;
}
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
{
......@@ -1765,8 +1739,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
int init_replication_sys_vars()
{
mysql_append_static_vars(fixed_vars, sizeof(fixed_vars) / sizeof(SHOW_VAR));
if (mysql_add_sys_var_chain(vars.first, my_long_options))
{
/* should not happen */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment