From e60c8c8b68d417b8efff48686c84751f3a772c76 Mon Sep 17 00:00:00 2001 From: Staale Smedseng Date: Thu, 20 Nov 2008 08:51:48 +0100 Subject: A fix for Bug#22891 "session level max_allowed_packet can be set but is ignored". This patch makes @@session.max_allowed_packed and @@session.net_buffer_length read-only as suggested in the bug report. The user will have to use SET GLOBAL (and reconnect) to alter the session values of these variables. The error string ER_VARIABLE_IS_READONLY is introduced. Tests are modified accordingly. --- mysql-test/r/variables.result | 47 ++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'mysql-test/r/variables.result') diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index aee84c98e4f..c52f7f3578e 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -228,7 +228,6 @@ VARIABLE_NAME VARIABLE_VALUE MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE set global net_retry_count=10, session net_retry_count=10; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; -set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; show global variables like 'net_%'; Variable_name Value net_buffer_length 1024 @@ -243,57 +242,45 @@ NET_RETRY_COUNT 10 NET_WRITE_TIMEOUT 200 show session variables like 'net_%'; Variable_name Value -net_buffer_length 2048 -net_read_timeout 600 +net_buffer_length 16384 +net_read_timeout 30 net_retry_count 10 -net_write_timeout 500 +net_write_timeout 60 select * from information_schema.session_variables where variable_name like 'net_%' order by 1; VARIABLE_NAME VARIABLE_VALUE -NET_BUFFER_LENGTH 2048 -NET_READ_TIMEOUT 600 +NET_BUFFER_LENGTH 16384 +NET_READ_TIMEOUT 30 NET_RETRY_COUNT 10 -NET_WRITE_TIMEOUT 500 -set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; +NET_WRITE_TIMEOUT 60 +set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; show global variables like 'net_%'; Variable_name Value -net_buffer_length 1024 +net_buffer_length 7168 net_read_timeout 900 net_retry_count 10 net_write_timeout 1000 select * from information_schema.global_variables where variable_name like 'net_%' order by 1; VARIABLE_NAME VARIABLE_VALUE -NET_BUFFER_LENGTH 1024 +NET_BUFFER_LENGTH 7168 NET_READ_TIMEOUT 900 NET_RETRY_COUNT 10 NET_WRITE_TIMEOUT 1000 -show session variables like 'net_%'; -Variable_name Value -net_buffer_length 7168 -net_read_timeout 600 -net_retry_count 10 -net_write_timeout 500 -select * from information_schema.session_variables where variable_name like 'net_%' order by 1; -VARIABLE_NAME VARIABLE_VALUE -NET_BUFFER_LENGTH 7168 -NET_READ_TIMEOUT 600 -NET_RETRY_COUNT 10 -NET_WRITE_TIMEOUT 500 -set net_buffer_length=1; +set global net_buffer_length=1; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '1' -show variables like 'net_buffer_length'; +show global variables like 'net_buffer_length'; Variable_name Value net_buffer_length 1024 -select * from information_schema.session_variables where variable_name like 'net_buffer_length'; +select * from information_schema.global_variables where variable_name like 'net_buffer_length'; VARIABLE_NAME VARIABLE_VALUE NET_BUFFER_LENGTH 1024 -set net_buffer_length=2000000000; +set global net_buffer_length=2000000000; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '2000000000' -show variables like 'net_buffer_length'; +show global variables like 'net_buffer_length'; Variable_name Value net_buffer_length 1048576 -select * from information_schema.session_variables where variable_name like 'net_buffer_length'; +select * from information_schema.global_variables where variable_name like 'net_buffer_length'; VARIABLE_NAME VARIABLE_VALUE NET_BUFFER_LENGTH 1048576 set character set cp1251_koi8; @@ -461,7 +448,7 @@ select @@long_query_time; @@long_query_time 100.000001 set low_priority_updates=1; -set max_allowed_packet=100; +set global max_allowed_packet=100; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '100' set global max_binlog_cache_size=100; @@ -485,7 +472,7 @@ select @@max_user_connections; 100 set global max_write_lock_count=100; set myisam_sort_buffer_size=100; -set net_buffer_length=100; +set global net_buffer_length=100; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '100' set net_read_timeout=100; -- cgit v1.2.1 From 3ea684935bbc589717963fd4639c7b7109750d09 Mon Sep 17 00:00:00 2001 From: Ingo Struewing Date: Sat, 22 Nov 2008 00:22:21 +0100 Subject: Bug#28234 - global/session scope - documentation vs implementation Several system variables did not behave like system variables should do. When trying to SET them or use them in SELECT, they were reported as "unknown system variable". But they appeared in SHOW VARIABLES. This has been fixed by removing the "fixed_vars" array of variables and integrating the variables into the normal system variables chain. All of these variables do now behave as read-only global-only variables. Trying to SET them tells they are read-only, trying to SELECT the session value tells they are global only. Selecting the global value works. It delivers the same value as SHOW VARIABLES. --- mysql-test/r/variables.result | 339 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) (limited to 'mysql-test/r/variables.result') diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index c52f7f3578e..878416b4537 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1011,3 +1011,342 @@ SET GLOBAL log_output = 0; ERROR 42000: Variable 'log_output' can't be set to the value of '0' # -- End of Bug#34820. + +# +SHOW VARIABLES like 'ft_max_word_len'; +Variable_name Value +ft_max_word_len 84 +SELECT @@session.ft_max_word_len; +ERROR HY000: Variable 'ft_max_word_len' is a GLOBAL variable +SELECT @@global.ft_max_word_len; +@@global.ft_max_word_len +84 +SET @@session.ft_max_word_len= 7; +ERROR HY000: Variable 'ft_max_word_len' is a read only variable +SET @@global.ft_max_word_len= 7; +ERROR HY000: Variable 'ft_max_word_len' is a read only variable +# +SHOW VARIABLES like 'ft_min_word_len'; +Variable_name Value +ft_min_word_len 4 +SELECT @@session.ft_min_word_len; +ERROR HY000: Variable 'ft_min_word_len' is a GLOBAL variable +SELECT @@global.ft_min_word_len; +@@global.ft_min_word_len +4 +SET @@session.ft_min_word_len= 7; +ERROR HY000: Variable 'ft_min_word_len' is a read only variable +SET @@global.ft_min_word_len= 7; +ERROR HY000: Variable 'ft_min_word_len' is a read only variable +# +SHOW VARIABLES like 'ft_query_expansion_limit'; +Variable_name Value +ft_query_expansion_limit 20 +SELECT @@session.ft_query_expansion_limit; +ERROR HY000: Variable 'ft_query_expansion_limit' is a GLOBAL variable +SELECT @@global.ft_query_expansion_limit; +@@global.ft_query_expansion_limit +20 +SET @@session.ft_query_expansion_limit= 7; +ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable +SET @@global.ft_query_expansion_limit= 7; +ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable +# +SHOW VARIABLES like 'ft_stopword_file'; +Variable_name Value +ft_stopword_file (built-in) +SELECT @@session.ft_stopword_file; +ERROR HY000: Variable 'ft_stopword_file' is a GLOBAL variable +SELECT @@global.ft_stopword_file; +@@global.ft_stopword_file +(built-in) +SET @@session.ft_stopword_file= 'x'; +ERROR HY000: Variable 'ft_stopword_file' is a read only variable +SET @@global.ft_stopword_file= 'x'; +ERROR HY000: Variable 'ft_stopword_file' is a read only variable +# +SHOW VARIABLES like 'back_log'; +Variable_name Value +back_log 50 +SELECT @@session.back_log; +ERROR HY000: Variable 'back_log' is a GLOBAL variable +SELECT @@global.back_log; +@@global.back_log +50 +SET @@session.back_log= 7; +ERROR HY000: Variable 'back_log' is a read only variable +SET @@global.back_log= 7; +ERROR HY000: Variable 'back_log' is a read only variable +# +SHOW VARIABLES like 'large_files_support'; +Variable_name Value +large_files_support # +SELECT @@session.large_files_support; +ERROR HY000: Variable 'large_files_support' is a GLOBAL variable +SELECT @@global.large_files_support; +@@global.large_files_support +# +SET @@session.large_files_support= true; +ERROR HY000: Variable 'large_files_support' is a read only variable +SET @@global.large_files_support= true; +ERROR HY000: Variable 'large_files_support' is a read only variable +# +SHOW VARIABLES like 'character_sets_dir'; +Variable_name Value +character_sets_dir # +SELECT @@session.character_sets_dir; +ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable +SELECT @@global.character_sets_dir; +@@global.character_sets_dir +# +SET @@session.character_sets_dir= 'x'; +ERROR HY000: Variable 'character_sets_dir' is a read only variable +SET @@global.character_sets_dir= 'x'; +ERROR HY000: Variable 'character_sets_dir' is a read only variable +# +SHOW VARIABLES like 'init_file'; +Variable_name Value +init_file # +SELECT @@session.init_file; +ERROR HY000: Variable 'init_file' is a GLOBAL variable +SELECT @@global.init_file; +@@global.init_file +# +SET @@session.init_file= 'x'; +ERROR HY000: Variable 'init_file' is a read only variable +SET @@global.init_file= 'x'; +ERROR HY000: Variable 'init_file' is a read only variable +# +SHOW VARIABLES like 'language'; +Variable_name Value +language # +SELECT @@session.language; +ERROR HY000: Variable 'language' is a GLOBAL variable +SELECT @@global.language; +@@global.language +# +SET @@session.language= 'x'; +ERROR HY000: Variable 'language' is a read only variable +SET @@global.language= 'x'; +ERROR HY000: Variable 'language' is a read only variable +# +SHOW VARIABLES like 'large_page_size'; +Variable_name Value +large_page_size # +SELECT @@session.large_page_size; +ERROR HY000: Variable 'large_page_size' is a GLOBAL variable +SELECT @@global.large_page_size; +@@global.large_page_size +# +SET @@session.large_page_size= 7; +ERROR HY000: Variable 'large_page_size' is a read only variable +SET @@global.large_page_size= 7; +ERROR HY000: Variable 'large_page_size' is a read only variable +# +SHOW VARIABLES like 'large_pages'; +Variable_name Value +large_pages # +SELECT @@session.large_pages; +ERROR HY000: Variable 'large_pages' is a GLOBAL variable +SELECT @@global.large_pages; +@@global.large_pages +# +SET @@session.large_pages= true; +ERROR HY000: Variable 'large_pages' is a read only variable +SET @@global.large_pages= true; +ERROR HY000: Variable 'large_pages' is a read only variable +# +SHOW VARIABLES like 'log_bin'; +Variable_name Value +log_bin OFF +SELECT @@session.log_bin; +ERROR HY000: Variable 'log_bin' is a GLOBAL variable +SELECT @@global.log_bin; +@@global.log_bin +0 +SET @@session.log_bin= true; +ERROR HY000: Variable 'log_bin' is a read only variable +SET @@global.log_bin= true; +ERROR HY000: Variable 'log_bin' is a read only variable +# +SHOW VARIABLES like 'log_error'; +Variable_name Value +log_error # +SELECT @@session.log_error; +ERROR HY000: Variable 'log_error' is a GLOBAL variable +SELECT @@global.log_error; +@@global.log_error +# +SET @@session.log_error= 'x'; +ERROR HY000: Variable 'log_error' is a read only variable +SET @@global.log_error= 'x'; +ERROR HY000: Variable 'log_error' is a read only variable +# +SHOW VARIABLES like 'lower_case_file_system'; +Variable_name Value +lower_case_file_system # +SELECT @@session.lower_case_file_system; +ERROR HY000: Variable 'lower_case_file_system' is a GLOBAL variable +SELECT @@global.lower_case_file_system; +@@global.lower_case_file_system +# +SET @@session.lower_case_file_system= true; +ERROR HY000: Variable 'lower_case_file_system' is a read only variable +SET @@global.lower_case_file_system= true; +ERROR HY000: Variable 'lower_case_file_system' is a read only variable +# +SHOW VARIABLES like 'lower_case_table_names'; +Variable_name Value +lower_case_table_names # +SELECT @@session.lower_case_table_names; +ERROR HY000: Variable 'lower_case_table_names' is a GLOBAL variable +SELECT @@global.lower_case_table_names; +@@global.lower_case_table_names +# +SET @@session.lower_case_table_names= 7; +ERROR HY000: Variable 'lower_case_table_names' is a read only variable +SET @@global.lower_case_table_names= 7; +ERROR HY000: Variable 'lower_case_table_names' is a read only variable +# +SHOW VARIABLES like 'myisam_recover_options'; +Variable_name Value +myisam_recover_options OFF +SELECT @@session.myisam_recover_options; +ERROR HY000: Variable 'myisam_recover_options' is a GLOBAL variable +SELECT @@global.myisam_recover_options; +@@global.myisam_recover_options +OFF +SET @@session.myisam_recover_options= 'x'; +ERROR HY000: Variable 'myisam_recover_options' is a read only variable +SET @@global.myisam_recover_options= 'x'; +ERROR HY000: Variable 'myisam_recover_options' is a read only variable +# +SHOW VARIABLES like 'open_files_limit'; +Variable_name Value +open_files_limit # +SELECT @@session.open_files_limit; +ERROR HY000: Variable 'open_files_limit' is a GLOBAL variable +SELECT @@global.open_files_limit; +@@global.open_files_limit +# +SET @@session.open_files_limit= 7; +ERROR HY000: Variable 'open_files_limit' is a read only variable +SET @@global.open_files_limit= 7; +ERROR HY000: Variable 'open_files_limit' is a read only variable +# +SHOW VARIABLES like 'pid_file'; +Variable_name Value +pid_file # +SELECT @@session.pid_file; +ERROR HY000: Variable 'pid_file' is a GLOBAL variable +SELECT @@global.pid_file; +@@global.pid_file +# +SET @@session.pid_file= 'x'; +ERROR HY000: Variable 'pid_file' is a read only variable +SET @@global.pid_file= 'x'; +ERROR HY000: Variable 'pid_file' is a read only variable +# +SHOW VARIABLES like 'plugin_dir'; +Variable_name Value +plugin_dir # +SELECT @@session.plugin_dir; +ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable +SELECT @@global.plugin_dir; +@@global.plugin_dir +# +SET @@session.plugin_dir= 'x'; +ERROR HY000: Variable 'plugin_dir' is a read only variable +SET @@global.plugin_dir= 'x'; +ERROR HY000: Variable 'plugin_dir' is a read only variable +# +SHOW VARIABLES like 'port'; +Variable_name Value +port # +SELECT @@session.port; +ERROR HY000: Variable 'port' is a GLOBAL variable +SELECT @@global.port; +@@global.port +# +SET @@session.port= 7; +ERROR HY000: Variable 'port' is a read only variable +SET @@global.port= 7; +ERROR HY000: Variable 'port' is a read only variable +# +SHOW VARIABLES like 'protocol_version'; +Variable_name Value +protocol_version 10 +SELECT @@session.protocol_version; +ERROR HY000: Variable 'protocol_version' is a GLOBAL variable +SELECT @@global.protocol_version; +@@global.protocol_version +10 +SET @@session.protocol_version= 7; +ERROR HY000: Variable 'protocol_version' is a read only variable +SET @@global.protocol_version= 7; +ERROR HY000: Variable 'protocol_version' is a read only variable +# +SHOW VARIABLES like 'skip_external_locking'; +Variable_name Value +skip_external_locking ON +SELECT @@session.skip_external_locking; +ERROR HY000: Variable 'skip_external_locking' is a GLOBAL variable +SELECT @@global.skip_external_locking; +@@global.skip_external_locking +1 +SET @@session.skip_external_locking= true; +ERROR HY000: Variable 'skip_external_locking' is a read only variable +SET @@global.skip_external_locking= true; +ERROR HY000: Variable 'skip_external_locking' is a read only variable +# +SHOW VARIABLES like 'skip_networking'; +Variable_name Value +skip_networking OFF +SELECT @@session.skip_networking; +ERROR HY000: Variable 'skip_networking' is a GLOBAL variable +SELECT @@global.skip_networking; +@@global.skip_networking +0 +SET @@session.skip_networking= true; +ERROR HY000: Variable 'skip_networking' is a read only variable +SET @@global.skip_networking= true; +ERROR HY000: Variable 'skip_networking' is a read only variable +# +SHOW VARIABLES like 'skip_show_database'; +Variable_name Value +skip_show_database OFF +SELECT @@session.skip_show_database; +ERROR HY000: Variable 'skip_show_database' is a GLOBAL variable +SELECT @@global.skip_show_database; +@@global.skip_show_database +0 +SET @@session.skip_show_database= true; +ERROR HY000: Variable 'skip_show_database' is a read only variable +SET @@global.skip_show_database= true; +ERROR HY000: Variable 'skip_show_database' is a read only variable +# +SHOW VARIABLES like 'socket'; +Variable_name Value +socket # +SELECT @@session.socket; +ERROR HY000: Variable 'socket' is a GLOBAL variable +SELECT @@global.socket; +@@global.socket +# +SET @@session.socket= 'x'; +ERROR HY000: Variable 'socket' is a read only variable +SET @@global.socket= 'x'; +ERROR HY000: Variable 'socket' is a read only variable +# +SHOW VARIABLES like 'thread_stack'; +Variable_name Value +thread_stack # +SELECT @@session.thread_stack; +ERROR HY000: Variable 'thread_stack' is a GLOBAL variable +SELECT @@global.thread_stack; +@@global.thread_stack +# +SET @@session.thread_stack= 7; +ERROR HY000: Variable 'thread_stack' is a read only variable +SET @@global.thread_stack= 7; +ERROR HY000: Variable 'thread_stack' is a read only variable -- cgit v1.2.1 From b903835265ce709a55f7df3f88d9cf32204992e5 Mon Sep 17 00:00:00 2001 From: Ingo Struewing Date: Thu, 27 Nov 2008 11:50:28 +0100 Subject: Bug#28234 - global/session scope - documentation vs implementation Post-pushbuild fix. - Windows does not have 'socket' system variable. - Compiler warning in sql/slave.cc --- mysql-test/r/variables.result | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'mysql-test/r/variables.result') diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 878416b4537..ac78d8e1871 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1325,19 +1325,6 @@ ERROR HY000: Variable 'skip_show_database' is a read only variable SET @@global.skip_show_database= true; ERROR HY000: Variable 'skip_show_database' is a read only variable # -SHOW VARIABLES like 'socket'; -Variable_name Value -socket # -SELECT @@session.socket; -ERROR HY000: Variable 'socket' is a GLOBAL variable -SELECT @@global.socket; -@@global.socket -# -SET @@session.socket= 'x'; -ERROR HY000: Variable 'socket' is a read only variable -SET @@global.socket= 'x'; -ERROR HY000: Variable 'socket' is a read only variable -# SHOW VARIABLES like 'thread_stack'; Variable_name Value thread_stack # -- cgit v1.2.1