List:Commits« Previous MessageNext Message »
From:Raghav Kapoor Date:November 10 2011 6:54am
Subject:bzr push into mysql-trunk branch (raghav.kapoor:3585 to 3586) Bug#11761014
View as plain text  
 3586 Raghav Kapoor	2011-11-10
      BUG#11761014 - 53466: END_CONNECTION() SHOULD REFERENCE GLOBAL_SYSTEM_VARIABLES.LOG_WARNINGS 
      
      BACKGROUND:
      end_connection prints out messages like this, depending on *session*
      log_warnings value:
      Aborted connection 2 to db: 'unconnected' user: 'root' 
      host: '' (Got timeout reading communication packets).
      This is wrong because it allows a minimally privileged user
      to write copious amounts of errors to the .err file, unless 
      he is restricted by the number of MAX_CONNECTIONS_PER_HOUR 
      in his user account.
      
      FIX:
      "Aborted connection..." messages are now printed based on 
      the *global* log_warnings value. Since this was the only real
      remaining use of the session value of log_warnings, the 
      log_warnings system variable has now been made to a global 
      only variable. This is a change of behavior and must be 
      reflected in the documentation.  

    modified:
      mysql-test/r/variables.result
      mysql-test/suite/sys_vars/inc/log_warnings_basic.inc
      mysql-test/suite/sys_vars/r/log_warnings_basic_32.result
      mysql-test/suite/sys_vars/r/log_warnings_basic_64.result
      mysql-test/t/variables.test
      sql/binlog.cc
      sql/filesort.cc
      sql/log_event.cc
      sql/mysqld.cc
      sql/mysqld.h
      sql/rpl_reporting.cc
      sql/rpl_rli_pdb.cc
      sql/rpl_slave.cc
      sql/sql_acl.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_plugin.cc
      sql/sql_udf.cc
      sql/sys_vars.cc
      storage/innobase/handler/ha_innodb.cc
 3585 Sneha Modi	2011-11-10 [merge]
       Bug#11754170:45729: TEST CASE FOR BUG#28211 IS DISABLED IN QUERY_CACHE.TEST
            
          Merging from mysql-5.5 -> mysql-trunk

    modified:
      mysql-test/r/query_cache.result
      mysql-test/t/query_cache.test
=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2011-10-13 14:01:50 +0000
+++ b/mysql-test/r/variables.result	2011-11-10 06:53:27 +0000
@@ -581,7 +581,6 @@ Warnings:
 Warning	1292	Truncated incorrect tmp_table_size value: '100'
 set tx_isolation="READ-COMMITTED";
 set wait_timeout=100;
-set log_warnings=1;
 set global log_warnings=1;
 select @@session.insert_id;
 @@session.insert_id

=== modified file 'mysql-test/suite/sys_vars/inc/log_warnings_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/log_warnings_basic.inc	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/inc/log_warnings_basic.inc	2011-11-10 06:53:27 +0000
@@ -1,7 +1,7 @@
 ############## mysql-test\t\log_warnings_basic.test ###############
 #                                                                             #
 # Variable Name: log_warnings                                                 #
-# Scope: GLOBAL | SESSION                                                     #
+# Scope: GLOBAL                                                     #
 # Access Type: Dynamic                                                        #
 # Data Type: numeric                                                          #
 # Default Value: 1                                                            #
@@ -36,8 +36,6 @@
 
 SET @start_global_value = @@global.log_warnings;
 SELECT @start_global_value;
-SET @start_session_value = @@session.log_warnings;
-SELECT @start_session_value;
 
 
 --echo '#--------------------FN_DYNVARS_067_01-------------------------#'
@@ -49,10 +47,6 @@ SET @@global.log_warnings = 100;
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings;
 
-SET @@session.log_warnings = 200;
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings;
-
 
 --echo '#--------------------FN_DYNVARS_067_02-------------------------#'
 ########################################################################
@@ -62,9 +56,6 @@ SELECT @@session.log_warnings;
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings = 1;
 
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings = 1;
-
 
 --echo '#--------------------FN_DYNVARS_067_03-------------------------#'
 ######################################################################
@@ -83,24 +74,7 @@ SET @@global.log_warnings = 65536;
 SELECT @@global.log_warnings;
 
 
---echo '#--------------------FN_DYNVARS_067_04-------------------------#'
-#######################################################################
-# Change the value of log_warnings to a valid value for SESSION Scope #
-#######################################################################
- 
-SET @@session.log_warnings = 0;
-SELECT @@session.log_warnings;
-SET @@session.log_warnings = 1;
-SELECT @@session.log_warnings;
-SET @@session.log_warnings = 50050;
-SELECT @@session.log_warnings;
-SET @@session.log_warnings = 65535;
-SELECT @@session.log_warnings;
-SET @@session.log_warnings = 65550;
-SELECT @@session.log_warnings;
-
-
---echo '#------------------FN_DYNVARS_067_05-----------------------#'
+--echo '#------------------FN_DYNVARS_067_04-----------------------#'
 ########################################################
 # Change the value of log_warnings to an invalid value #
 ########################################################
@@ -116,39 +90,18 @@ SELECT @@global.log_warnings;
 SET @@global.log_warnings = test;
 SELECT @@global.log_warnings;
 
-SET @@session.log_warnings = 100000000000;
-SELECT @@session.log_warnings;
-SET @@session.log_warnings = -2;
-SELECT @@session.log_warnings;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.log_warnings = 65530.34;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.log_warnings = test;
-SELECT @@session.log_warnings;
 
-
---echo '#------------------FN_DYNVARS_067_06-----------------------#'
+--echo '#------------------FN_DYNVARS_067_05-----------------------#'
 ####################################################################
 #   Check if the value in GLOBAL Table matches value in variable   #
 ####################################################################
 
-
 SELECT @@global.log_warnings = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 WHERE VARIABLE_NAME='log_warnings';
 
---echo '#------------------FN_DYNVARS_067_07-----------------------#'
-####################################################################
-#  Check if the value in SESSION Table matches value in variable   #
-####################################################################
-
-SELECT @@session.log_warnings = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='log_warnings';
-
 
---echo '#------------------FN_DYNVARS_067_08-----------------------#'
+--echo '#------------------FN_DYNVARS_067_06-----------------------#'
 ####################################################################
 #     Check if TRUE and FALSE values can be used on variable       #
 ####################################################################
@@ -159,7 +112,7 @@ SET @@global.log_warnings = FALSE;
 SELECT @@global.log_warnings;
 
 
---echo '#---------------------FN_DYNVARS_067_09----------------------#'
+--echo '#---------------------FN_DYNVARS_067_07----------------------#'
 #################################################################################
 #  Check if accessing variable with and without GLOBAL point to same variable   #
 #################################################################################
@@ -168,39 +121,12 @@ SET @@global.log_warnings = 10;
 SELECT @@log_warnings = @@global.log_warnings;
 
 
---echo '#---------------------FN_DYNVARS_067_10----------------------#'
-########################################################################################################
-#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
-########################################################################################################
-
-SET @@log_warnings = 100;
-SELECT @@log_warnings = @@local.log_warnings;
-SELECT @@local.log_warnings = @@session.log_warnings;
-
-
---echo '#---------------------FN_DYNVARS_067_11----------------------#'
-#######################################################################
-#   Check if log_warnings can be accessed with and without @@ sign    #
-#######################################################################
-
-SET log_warnings = 1;
-SELECT @@log_warnings;
---Error ER_UNKNOWN_TABLE
-SELECT local.log_warnings;
---Error ER_UNKNOWN_TABLE
-SELECT session.log_warnings;
---Error ER_BAD_FIELD_ERROR
-SELECT log_warnings = @@session.log_warnings;
-
-
 ####################################
 #     Restore initial value        #
 ####################################
 
 SET @@global.log_warnings = @start_global_value;
 SELECT @@global.log_warnings;
-SET @@session.log_warnings = @start_session_value;
-SELECT @@session.log_warnings;
 
 
 #############################################################

=== modified file 'mysql-test/suite/sys_vars/r/log_warnings_basic_32.result'
--- a/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result	2011-11-10 06:53:27 +0000
@@ -2,30 +2,17 @@ SET @start_global_value = @@global.log_w
 SELECT @start_global_value;
 @start_global_value
 1
-SET @start_session_value = @@session.log_warnings;
-SELECT @start_session_value;
-@start_session_value
-1
 '#--------------------FN_DYNVARS_067_01-------------------------#'
 SET @@global.log_warnings = 100;
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 1
-SET @@session.log_warnings = 200;
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1
 '#--------------------FN_DYNVARS_067_02-------------------------#'
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings = 1;
 @@global.log_warnings = 1
 1
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings = 1;
-@@session.log_warnings = 1
-1
 '#--------------------FN_DYNVARS_067_03-------------------------#'
 SET @@global.log_warnings = 0;
 SELECT @@global.log_warnings;
@@ -47,28 +34,7 @@ SET @@global.log_warnings = 65536;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 65536
-'#--------------------FN_DYNVARS_067_04-------------------------#'
-SET @@session.log_warnings = 0;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-SET @@session.log_warnings = 1;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1
-SET @@session.log_warnings = 50050;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-50050
-SET @@session.log_warnings = 65535;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-65535
-SET @@session.log_warnings = 65550;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-65550
-'#------------------FN_DYNVARS_067_05-----------------------#'
+'#------------------FN_DYNVARS_067_04-----------------------#'
 SET @@global.log_warnings = 100000000000;
 Warnings:
 Warning	1292	Truncated incorrect log_warnings value: '100000000000'
@@ -91,38 +57,13 @@ ERROR 42000: Incorrect argument type to
 SELECT @@global.log_warnings;
 @@global.log_warnings
 0
-SET @@session.log_warnings = 100000000000;
-Warnings:
-Warning	1292	Truncated incorrect log_warnings value: '100000000000'
-SELECT @@session.log_warnings;
-@@session.log_warnings
-4294967295
-SET @@session.log_warnings = -2;
-Warnings:
-Warning	1292	Truncated incorrect log_warnings value: '-2'
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-SET @@session.log_warnings = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'log_warnings'
-SET @@session.log_warnings = test;
-ERROR 42000: Incorrect argument type to variable 'log_warnings'
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-'#------------------FN_DYNVARS_067_06-----------------------#'
+'#------------------FN_DYNVARS_067_05-----------------------#'
 SELECT @@global.log_warnings = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 WHERE VARIABLE_NAME='log_warnings';
 @@global.log_warnings = VARIABLE_VALUE
 1
-'#------------------FN_DYNVARS_067_07-----------------------#'
-SELECT @@session.log_warnings = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='log_warnings';
-@@session.log_warnings = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_067_08-----------------------#'
+'#------------------FN_DYNVARS_067_06-----------------------#'
 SET @@global.log_warnings = TRUE;
 SELECT @@global.log_warnings;
 @@global.log_warnings
@@ -131,35 +72,12 @@ SET @@global.log_warnings = FALSE;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 0
-'#---------------------FN_DYNVARS_067_09----------------------#'
+'#---------------------FN_DYNVARS_067_07----------------------#'
 SET @@global.log_warnings = 10;
 SELECT @@log_warnings = @@global.log_warnings;
 @@log_warnings = @@global.log_warnings
 0
-'#---------------------FN_DYNVARS_067_10----------------------#'
-SET @@log_warnings = 100;
-SELECT @@log_warnings = @@local.log_warnings;
-@@log_warnings = @@local.log_warnings
-1
-SELECT @@local.log_warnings = @@session.log_warnings;
-@@local.log_warnings = @@session.log_warnings
-1
-'#---------------------FN_DYNVARS_067_11----------------------#'
-SET log_warnings = 1;
-SELECT @@log_warnings;
-@@log_warnings
-1
-SELECT local.log_warnings;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT session.log_warnings;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT log_warnings = @@session.log_warnings;
-ERROR 42S22: Unknown column 'log_warnings' in 'field list'
 SET @@global.log_warnings = @start_global_value;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 1
-SET @@session.log_warnings = @start_session_value;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1

=== modified file 'mysql-test/suite/sys_vars/r/log_warnings_basic_64.result'
--- a/mysql-test/suite/sys_vars/r/log_warnings_basic_64.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/r/log_warnings_basic_64.result	2011-11-10 06:53:27 +0000
@@ -2,30 +2,17 @@ SET @start_global_value = @@global.log_w
 SELECT @start_global_value;
 @start_global_value
 1
-SET @start_session_value = @@session.log_warnings;
-SELECT @start_session_value;
-@start_session_value
-1
 '#--------------------FN_DYNVARS_067_01-------------------------#'
 SET @@global.log_warnings = 100;
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 1
-SET @@session.log_warnings = 200;
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1
 '#--------------------FN_DYNVARS_067_02-------------------------#'
 SET @@global.log_warnings = DEFAULT;
 SELECT @@global.log_warnings = 1;
 @@global.log_warnings = 1
 1
-SET @@session.log_warnings = DEFAULT;
-SELECT @@session.log_warnings = 1;
-@@session.log_warnings = 1
-1
 '#--------------------FN_DYNVARS_067_03-------------------------#'
 SET @@global.log_warnings = 0;
 SELECT @@global.log_warnings;
@@ -47,28 +34,7 @@ SET @@global.log_warnings = 65536;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 65536
-'#--------------------FN_DYNVARS_067_04-------------------------#'
-SET @@session.log_warnings = 0;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-SET @@session.log_warnings = 1;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1
-SET @@session.log_warnings = 50050;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-50050
-SET @@session.log_warnings = 65535;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-65535
-SET @@session.log_warnings = 65550;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-65550
-'#------------------FN_DYNVARS_067_05-----------------------#'
+'#------------------FN_DYNVARS_067_04-----------------------#'
 SET @@global.log_warnings = 100000000000;
 SELECT @@global.log_warnings;
 @@global.log_warnings
@@ -89,36 +55,13 @@ ERROR 42000: Incorrect argument type to
 SELECT @@global.log_warnings;
 @@global.log_warnings
 0
-SET @@session.log_warnings = 100000000000;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-100000000000
-SET @@session.log_warnings = -2;
-Warnings:
-Warning	1292	Truncated incorrect log_warnings value: '-2'
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-SET @@session.log_warnings = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'log_warnings'
-SET @@session.log_warnings = test;
-ERROR 42000: Incorrect argument type to variable 'log_warnings'
-SELECT @@session.log_warnings;
-@@session.log_warnings
-0
-'#------------------FN_DYNVARS_067_06-----------------------#'
+'#------------------FN_DYNVARS_067_05-----------------------#'
 SELECT @@global.log_warnings = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 WHERE VARIABLE_NAME='log_warnings';
 @@global.log_warnings = VARIABLE_VALUE
 1
-'#------------------FN_DYNVARS_067_07-----------------------#'
-SELECT @@session.log_warnings = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='log_warnings';
-@@session.log_warnings = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_067_08-----------------------#'
+'#------------------FN_DYNVARS_067_06-----------------------#'
 SET @@global.log_warnings = TRUE;
 SELECT @@global.log_warnings;
 @@global.log_warnings
@@ -127,35 +70,12 @@ SET @@global.log_warnings = FALSE;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 0
-'#---------------------FN_DYNVARS_067_09----------------------#'
+'#---------------------FN_DYNVARS_067_07----------------------#'
 SET @@global.log_warnings = 10;
 SELECT @@log_warnings = @@global.log_warnings;
 @@log_warnings = @@global.log_warnings
-0
-'#---------------------FN_DYNVARS_067_10----------------------#'
-SET @@log_warnings = 100;
-SELECT @@log_warnings = @@local.log_warnings;
-@@log_warnings = @@local.log_warnings
-1
-SELECT @@local.log_warnings = @@session.log_warnings;
-@@local.log_warnings = @@session.log_warnings
-1
-'#---------------------FN_DYNVARS_067_11----------------------#'
-SET log_warnings = 1;
-SELECT @@log_warnings;
-@@log_warnings
-1
-SELECT local.log_warnings;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT session.log_warnings;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT log_warnings = @@session.log_warnings;
-ERROR 42S22: Unknown column 'log_warnings' in 'field list'
+1
 SET @@global.log_warnings = @start_global_value;
 SELECT @@global.log_warnings;
 @@global.log_warnings
 1
-SET @@session.log_warnings = @start_session_value;
-SELECT @@session.log_warnings;
-@@session.log_warnings
-1

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2011-04-12 12:48:26 +0000
+++ b/mysql-test/t/variables.test	2011-11-10 06:53:27 +0000
@@ -356,7 +356,6 @@ set timestamp=1, timestamp=default;
 set tmp_table_size=100;
 set tx_isolation="READ-COMMITTED";
 set wait_timeout=100;
-set log_warnings=1;
 set global log_warnings=1;
 
 #

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2011-11-03 16:03:34 +0000
+++ b/sql/binlog.cc	2011-11-10 06:53:27 +0000
@@ -5975,7 +5975,7 @@ void THD::issue_unsafe_warnings()
                           ER_BINLOG_UNSAFE_STATEMENT,
                           ER(ER_BINLOG_UNSAFE_STATEMENT),
                           ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
       {
         char buf[MYSQL_ERRMSG_SIZE * 2];
         sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT),

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2011-11-07 15:32:36 +0000
+++ b/sql/filesort.cc	2011-11-10 06:53:27 +0000
@@ -425,7 +425,7 @@ ha_rows filesort(THD *thd, TABLE *table,
                     ER(kill_errno) :
                     thd->get_stmt_da()->message());
 
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
     {
       sql_print_warning("%s, host: %s, user: %s, thread: %lu, query: %-.4096s",
                         ER_THD(thd, ER_FILSORT_ABORT),

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-10-28 12:45:35 +0000
+++ b/sql/log_event.cc	2011-11-10 06:53:27 +0000
@@ -360,7 +360,7 @@ int convert_handler_error(int error, THD
     actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
                         ER_UNKNOWN_ERROR);
     if (actual_error == ER_UNKNOWN_ERROR)
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
         sql_print_warning("Unknown error detected %d in handler", error);
   }
 
@@ -8898,7 +8898,7 @@ int Rows_log_event::do_apply_event(Relay
 
         if (idempotent_error || ignored_error)
         {
-          if (global_system_variables.log_warnings)
+          if (log_warnings)
             slave_rows_error_report(WARNING_LEVEL, error, rli, thd, table,
                                     get_type_str(),
                                     const_cast<Relay_log_info*>(rli)->get_rpl_log_name(),
@@ -8977,7 +8977,7 @@ int Rows_log_event::do_apply_event(Relay
         ignored_error_code(convert_handler_error(error, thd, table)))
     {
 
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
         slave_rows_error_report(WARNING_LEVEL, error, rli, thd, table,
                                 get_type_str(),
                                 const_cast<Relay_log_info*>(rli)->get_rpl_log_name(),

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-11-08 04:28:05 +0000
+++ b/sql/mysqld.cc	2011-11-10 06:53:27 +0000
@@ -377,6 +377,7 @@ my_bool locked_in_memory;
 bool opt_using_transactions;
 bool volatile abort_loop;
 bool volatile shutdown_in_progress;
+ulong log_warnings;
 /*
   True if the bootstrap thread is running. Protected by LOCK_thread_count,
   just like thread_count.
@@ -1247,7 +1248,7 @@ static void close_connections(void)
 #ifndef __bsdi__        // Bug in BSDI kernel
     if (tmp->vio_ok())
     {
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
         sql_print_warning(ER_DEFAULT(ER_FORCING_CLOSE),my_progname,
                           tmp->thread_id,
                           (tmp->main_security_ctx.user ?
@@ -1441,7 +1442,7 @@ pthread_handler_t kill_server_thread(voi
 
 extern "C" sig_handler print_signal_warning(int sig)
 {
-  if (global_system_variables.log_warnings)
+  if (log_warnings)
     sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
 #ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
   my_sigset(sig,print_signal_warning);    /* int. thread system calls */
@@ -1759,7 +1760,7 @@ static struct passwd *check_user(const c
       /* purecov: begin tested */
       tmp_user_info= getpwnam(user);
       if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
-    global_system_variables.log_warnings)
+    log_warnings)
         sql_print_warning(
                     "One can only use the --user switch if running as root\n");
       /* purecov: end */
@@ -2741,7 +2742,7 @@ void my_init_signals(void)
     /* Change limits so that we will get a core file */
     STRUCT_RLIMIT rl;
     rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
-    if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
+    if (setrlimit(RLIMIT_CORE, &rl) && log_warnings)
       sql_print_warning("setrlimit could not change the size of core files to 'infinity';  We may not be able to generate a core file on signals");
   }
 #endif
@@ -3614,11 +3615,11 @@ int init_common_variables()
   DBUG_PRINT("warning",
        ("Changed limits: max_open_files: %u  max_connections: %ld  table_cache: %ld",
         files, max_connections, table_cache_size));
-  if (global_system_variables.log_warnings)
+  if (log_warnings)
     sql_print_warning("Changed limits: max_open_files: %u  max_connections: %ld  table_cache: %ld",
       files, max_connections, table_cache_size);
       }
-      else if (global_system_variables.log_warnings)
+      else if (log_warnings)
   sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
     }
     open_files_limit= files;
@@ -3765,7 +3766,7 @@ int init_common_variables()
   {
     if (lower_case_table_names_used)
     {
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
   sql_print_warning("\
 You have forced lower_case_table_names to 0 through a command-line \
 option, even though your file system '%s' is case insensitive.  This means \
@@ -3775,7 +3776,7 @@ You should consider changing lower_case_
     }
     else
     {
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
   sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home);
       lower_case_table_names= 2;
     }
@@ -3784,7 +3785,7 @@ You should consider changing lower_case_
            !(lower_case_file_system=
              (test_if_case_insensitive(mysql_real_data_home) == 1)))
   {
-    if (global_system_variables.log_warnings)
+    if (log_warnings)
       sql_print_warning("lower_case_table_names was set to 2, even though your "
                         "the file system '%s' is case sensitive.  Now setting "
                         "lower_case_table_names to 0 to avoid future problems.",
@@ -4566,7 +4567,7 @@ a file name for --log-bin-index option",
     }
     if (mlockall(MCL_CURRENT))
     {
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
   sql_print_warning("Failed to lock memory. Errno: %d\n",errno);
       locked_in_memory= 0;
     }
@@ -4911,7 +4912,7 @@ int mysqld_main(int argc, char **argv)
     /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
     if (stack_size && stack_size < my_thread_stack_size)
     {
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
   sql_print_warning("Asked for %lu thread stack, but got %ld",
         my_thread_stack_size, (long) stack_size);
 #if defined(__ia64__) || defined(__ia64)
@@ -7611,11 +7612,11 @@ mysqld_get_one_option(int optid,
 #endif /*EMBEDDED_LIBRARY*/
   case 'W':
     if (!argument)
-      global_system_variables.log_warnings++;
+      log_warnings++;
     else if (argument == disabled_my_option)
-      global_system_variables.log_warnings= 0L;
+      log_warnings= 0L;
     else
-      global_system_variables.log_warnings= atoi(argument);
+      log_warnings= atoi(argument);
     break;
   case 'T':
     test_flags= argument ? (uint) atoi(argument) : 0;
@@ -7893,7 +7894,7 @@ static void option_error_reporter(enum l
 
   /* Don't print warnings for --loose options during bootstrap */
   if (level == ERROR_LEVEL || !opt_bootstrap ||
-      global_system_variables.log_warnings)
+      log_warnings)
   {
     vprint_msg_to_log(level, format, args);
   }

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-11-01 16:33:58 +0000
+++ b/sql/mysqld.h	2011-11-10 06:53:27 +0000
@@ -234,6 +234,7 @@ extern I_List<THD> threads;
 extern char err_shared_dir[];
 extern TYPELIB thread_handling_typelib;
 extern my_decimal decimal_zero;
+extern ulong log_warnings;
 
 /*
   THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,

=== modified file 'sql/rpl_reporting.cc'
--- a/sql/rpl_reporting.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_reporting.cc	2011-11-10 06:53:27 +0000
@@ -139,11 +139,11 @@ Slave_reporting_capability::va_report(lo
     report_function= sql_print_error;
     break;
   case WARNING_LEVEL:
-    report_function= global_system_variables.log_warnings?
+    report_function= log_warnings?
       sql_print_warning : NULL;
     break;
   case INFORMATION_LEVEL:
-    report_function= global_system_variables.log_warnings?
+    report_function= log_warnings?
       sql_print_information : NULL;
     break;
   default:

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-10-13 14:01:50 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-11-10 06:53:27 +0000
@@ -1358,7 +1358,7 @@ int wait_for_workers_to_finish(Relay_log
   DBUG_ENTER("wait_for_workers_to_finish");
 
   llstr(const_cast<Relay_log_info*>(rli)->get_event_relay_log_pos(), llbuf);
-  if (global_system_variables.log_warnings > 1)
+  if (log_warnings > 1)
     sql_print_information("Coordinator and workers enter synchronization procedure "
                           "when scheduling event relay-log: %s pos: %s", 
                           const_cast<Relay_log_info*>(rli)->get_event_relay_log_name(), 
@@ -1416,7 +1416,7 @@ int wait_for_workers_to_finish(Relay_log
 
   if (!ignore)
   {
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
       sql_print_information("Coordinator synchronized with Workers, "
                             "waited entries: %d, cant_sync: %d", 
                             ret, cant_sync);
@@ -1815,7 +1815,7 @@ err:
   if (error)
   {
 
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
       sql_print_information("Worker %lu is exiting: killed %i, error %i, "
                             "running_status %d",
                             worker->id, thd->killed, thd->is_error(),

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-11-04 12:59:47 +0000
+++ b/sql/rpl_slave.cc	2011-11-10 06:53:27 +0000
@@ -3279,7 +3279,7 @@ static bool check_io_slave_killed(THD *t
 {
   if (io_slave_killed(thd, mi))
   {
-    if (info && global_system_variables.log_warnings)
+    if (info && log_warnings)
       sql_print_information("%s", info);
     return TRUE;
   }
@@ -3354,7 +3354,7 @@ static int try_to_reconnect(THD *thd, MY
   }
   if (safe_reconnect(thd, mysql, mi, 1) || io_slave_killed(thd, mi))
   {
-    if (global_system_variables.log_warnings)
+    if (log_warnings)
       sql_print_information("%s", messages[SLAVE_RECON_MSG_KILLED_AFTER]);
     return 1;
   }
@@ -3889,7 +3889,7 @@ pthread_handler_t handle_slave_worker(vo
   mysql_mutex_lock(&w->jobs_lock);
 
   w->running_status= Slave_worker::NOT_RUNNING;
-  if (global_system_variables.log_warnings > 1)
+  if (log_warnings > 1)
     sql_print_information("Worker %lu statistics: "
                           "events processed = %lu "
                           "hungry waits = %lu "
@@ -4541,7 +4541,7 @@ void slave_stop_workers(Relay_log_info *
 
     mysql_mutex_unlock(&w->jobs_lock);
 
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
       sql_print_information("Notifying Worker %lu to exit, thd %p", w->id,
                             w->info_thd);
   }
@@ -4575,7 +4575,7 @@ void slave_stop_workers(Relay_log_info *
     delete w;
   }
 
-  if (global_system_variables.log_warnings > 1)
+  if (log_warnings > 1)
     sql_print_information("Multi-threaded slave statistics: "
                           "events processed = %lu ;"
                           "worker queues filled over overrun level = %lu ;"
@@ -4758,7 +4758,7 @@ pthread_handler_t handle_slave_sql(void
   DBUG_PRINT("master_info",("log_file_name: %s  position: %s",
                             rli->get_group_master_log_name(),
                             llstr(rli->get_group_master_log_pos(),llbuff)));
-  if (global_system_variables.log_warnings)
+  if (log_warnings)
     sql_print_information("Slave SQL thread initialized, starting replication in \
 log '%s' at position %s, relay log '%s' position: %s", rli->get_rpl_log_name(),
                     llstr(rli->get_group_master_log_pos(),llbuff),rli->get_group_relay_log_name(),
@@ -5886,7 +5886,7 @@ static int connect_to_master(THD* thd, M
     mi->clear_error(); // clear possible left over reconnect error
     if (reconnect)
     {
-      if (!suppress_warnings && global_system_variables.log_warnings)
+      if (!suppress_warnings && log_warnings)
         sql_print_information("Slave: connected to master '%s@%s:%d',\
 replication resumed in log '%s' at position %s", mi->user,
                         mi->host, mi->port,
@@ -6420,7 +6420,7 @@ static Log_event* next_event(Relay_log_i
       if (rli->relay_log.is_active(rli->linfo.log_file_name))
       {
 #ifdef EXTRA_DEBUG
-        if (global_system_variables.log_warnings)
+        if (log_warnings)
           sql_print_information("next log '%s' is currently active",
                                 rli->linfo.log_file_name);
 #endif
@@ -6507,7 +6507,7 @@ static Log_event* next_event(Relay_log_i
         from hot to cold, but not from cold to hot). No need for LOCK_log.
       */
 #ifdef EXTRA_DEBUG
-      if (global_system_variables.log_warnings)
+      if (log_warnings)
         sql_print_information("next log '%s' is not active",
                               rli->linfo.log_file_name);
 #endif
@@ -6534,7 +6534,7 @@ event(errno: %d  cur_log->error: %d)",
       break;                                    // To end of function
     }
   }
-  if (!errmsg && global_system_variables.log_warnings)
+  if (!errmsg && log_warnings)
   {
     sql_print_information("Error reading relay log event: %s",
                           "slave SQL thread was killed");

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-10-28 12:45:35 +0000
+++ b/sql/sql_acl.cc	2011-11-10 06:53:27 +0000
@@ -8038,7 +8038,7 @@ static void login_failed_error(MPVIO_EXT
       so that the overhead of the general query log is not required to track 
       failed connections.
     */
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
     {
       sql_print_warning(ER(ER_ACCESS_DENIED_NO_PASSWORD_ERROR),
                         mpvio->auth_info.user_name,
@@ -8060,7 +8060,7 @@ static void login_failed_error(MPVIO_EXT
       so that the overhead of the general query log is not required to track 
       failed connections.
     */
-    if (global_system_variables.log_warnings > 1)
+    if (log_warnings > 1)
     {
       sql_print_warning(ER(ER_ACCESS_DENIED_ERROR),
                         mpvio->auth_info.user_name,
@@ -9162,7 +9162,7 @@ static bool acl_check_ssl(THD *thd, cons
                          acl_user->ssl_cipher, SSL_get_cipher(ssl)));
       if (strcmp(acl_user->ssl_cipher, SSL_get_cipher(ssl)))
       {
-        if (global_system_variables.log_warnings)
+        if (log_warnings)
           sql_print_information("X509 ciphers mismatch: should be '%s' but is '%s'",
                             acl_user->ssl_cipher, SSL_get_cipher(ssl));
         return 1;
@@ -9179,7 +9179,7 @@ static bool acl_check_ssl(THD *thd, cons
                          acl_user->x509_issuer, ptr));
       if (strcmp(acl_user->x509_issuer, ptr))
       {
-        if (global_system_variables.log_warnings)
+        if (log_warnings)
           sql_print_information("X509 issuer mismatch: should be '%s' "
                             "but is '%s'", acl_user->x509_issuer, ptr);
         free(ptr);
@@ -9196,7 +9196,7 @@ static bool acl_check_ssl(THD *thd, cons
                          acl_user->x509_subject, ptr));
       if (strcmp(acl_user->x509_subject, ptr))
       {
-        if (global_system_variables.log_warnings)
+        if (log_warnings)
           sql_print_information("X509 subject mismatch: should be '%s' but is '%s'",
                           acl_user->x509_subject, ptr);
         free(ptr);

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-11-08 04:28:05 +0000
+++ b/sql/sql_class.h	2011-11-10 06:53:27 +0000
@@ -489,7 +489,6 @@ typedef struct system_variables
   ulong query_prealloc_size;
   ulong trans_alloc_block_size;
   ulong trans_prealloc_size;
-  ulong log_warnings;
   ulong group_concat_max_len;
 
   ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2011-08-29 12:08:58 +0000
+++ b/sql/sql_connect.cc	2011-11-10 06:53:27 +0000
@@ -629,7 +629,7 @@ void end_connection(THD *thd)
 
   if (net->error && net->vio != 0)
   {
-    if (!thd->killed && thd->variables.log_warnings > 1)
+    if (!thd->killed && log_warnings > 1)
     {
       Security_context *sctx= thd->security_ctx;
 

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2011-10-28 12:45:35 +0000
+++ b/sql/sql_plugin.cc	2011-11-10 06:53:27 +0000
@@ -3493,7 +3493,7 @@ static int test_plugin_options(MEM_ROOT
   */
   if (disable_plugin)
   {
-    if (global_system_variables.log_warnings)
+    if (log_warnings)
       sql_print_information("Plugin '%s' is disabled.",
                             tmp->name.str);
     if (opts)

=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc	2011-10-27 08:43:56 +0000
+++ b/sql/sql_udf.cc	2011-11-10 06:53:27 +0000
@@ -87,8 +87,7 @@ static char *init_syms(udf_func *tmp, ch
   {
     if (!opt_allow_suspicious_udfs)
       return nm;
-    if (current_thd->variables.log_warnings)
-      sql_print_warning(ER(ER_CANT_FIND_DL_ENTRY), nm);
+    sql_print_warning(ER(ER_CANT_FIND_DL_ENTRY), nm);
   }
   return 0;
 }

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-11-01 16:33:58 +0000
+++ b/sql/sys_vars.cc	2011-11-10 06:53:27 +0000
@@ -1220,7 +1220,7 @@ static Sys_var_mybool Sys_log_queries_no
 static Sys_var_ulong Sys_log_warnings(
        "log_warnings",
        "Log some not critical warnings to the log file",
-       SESSION_VAR(log_warnings),
+       GLOBAL_VAR(log_warnings),
        CMD_LINE(OPT_ARG, 'W'),
        VALID_RANGE(0, ULONG_MAX), DEFAULT(1), BLOCK_SIZE(1));
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-11-07 12:04:41 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-11-10 06:53:27 +0000
@@ -1293,7 +1293,7 @@ innobase_get_cset_width(
 
 			/* Fix bug#46256: allow tables to be dropped if the
 			collation is not found, but issue a warning. */
-			if ((global_system_variables.log_warnings)
+			if ((log_warnings)
 			    && (cset != 0)){
 
 				sql_print_warning(
@@ -3379,7 +3379,7 @@ innobase_close_connection(
 	}
 
 
-	if (trx_is_started(trx) && global_system_variables.log_warnings) {
+	if (trx_is_started(trx) && log_warnings) {
 
 		sql_print_warning(
 			"MySQL is closing a connection that has an active "

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (raghav.kapoor:3585 to 3586) Bug#11761014Raghav Kapoor11 Nov