List:Commits« Previous MessageNext Message »
From:Tatiana Azundris Nurnberg Date:January 6 2011 8:00am
Subject:bzr commit into mysql-trunk-merge branch (azundris:3261) Bug#56124
View as plain text  
#At file:///Users/tnurnberg/forest/56-56124/ based on revid:vasil.dimov@stripped

 3261 Tatiana Azundris Nurnberg	2011-01-06
      Bug#56124: implement global variable to show current value of core-file
      
      implements feature, adds tests.
     @ mysql-test/suite/sys_vars/r/core_file_basic.result
        test results
     @ mysql-test/suite/sys_vars/t/core_file_basic-master.opt
        turn on core-dumps
     @ mysql-test/suite/sys_vars/t/core_file_basic.test
        show that I/S and SHOW VARIABLES displays work
     @ sql/mysqld.cc
        throw a courtesy warning if user gives contradictory command line switches
        and we turn core dumps back off
     @ sql/sys_vars.cc
        add a read-only display for whether core-dumps are enabled.
     @ sql/sys_vars.h
        implement a boolean display for whether core-dumps are enabled.
        this is derived from the global test_flags bit vector on the fly.

    added:
      mysql-test/suite/sys_vars/r/core_file_basic.result
      mysql-test/suite/sys_vars/t/core_file_basic-master.opt
      mysql-test/suite/sys_vars/t/core_file_basic.test
    modified:
      sql/mysqld.cc
      sql/sys_vars.cc
      sql/sys_vars.h
=== added file 'mysql-test/suite/sys_vars/r/core_file_basic.result'
--- a/mysql-test/suite/sys_vars/r/core_file_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/core_file_basic.result	2011-01-06 08:00:12 +0000
@@ -0,0 +1,6 @@
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE '%core%';
+VARIABLE_NAME	VARIABLE_VALUE
+CORE_FILE	ON
+SHOW GLOBAL VARIABLES LIKE '%core%';
+Variable_name	Value
+core_file	ON

=== added file 'mysql-test/suite/sys_vars/t/core_file_basic-master.opt'
--- a/mysql-test/suite/sys_vars/t/core_file_basic-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/core_file_basic-master.opt	2011-01-06 08:00:12 +0000
@@ -0,0 +1,2 @@
+--core-file
+

=== added file 'mysql-test/suite/sys_vars/t/core_file_basic.test'
--- a/mysql-test/suite/sys_vars/t/core_file_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/core_file_basic.test	2011-01-06 08:00:12 +0000
@@ -0,0 +1,2 @@
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE '%core%';
+SHOW GLOBAL VARIABLES LIKE '%core%';

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-10-09 10:25:01 +0000
+++ b/sql/mysqld.cc	2011-01-06 08:00:12 +0000
@@ -7435,7 +7435,11 @@ static int get_options(int *argc_ptr, ch
   {
     /* Allow break with SIGINT, no core or stack trace */
     test_flags|= TEST_SIGINT | TEST_NO_STACKTRACE;
-    test_flags&= ~TEST_CORE_ON_SIGNAL;
+    if (test_flags & TEST_CORE_ON_SIGNAL)
+    {
+      test_flags&= ~TEST_CORE_ON_SIGNAL;
+      sql_print_warning("option --gdb given, ignoring --core-file");
+    }
   }
   /* Set global MyISAM variables from delay_key_write_options */
   fix_delay_key_write(0, 0, OPT_GLOBAL);

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-10-08 12:57:46 +0000
+++ b/sql/sys_vars.cc	2011-01-06 08:00:12 +0000
@@ -312,6 +312,9 @@ static bool fix_binlog_format_after_upda
   return false;
 }
 
+static Sys_var_core_file Sys_core_file(
+       "core_file", "write a core-file on crashes");
+
 static Sys_var_enum Sys_binlog_format(
        "binlog_format", "What form of binary logging the master will "
        "use: either ROW for row-based binary logging, STATEMENT "
@@ -1408,7 +1411,7 @@ static Sys_var_proxy_user Sys_proxy_user
        "proxy_user", "The proxy user account name used when logging in",
        IN_SYSTEM_CHARSET);
 
-static Sys_var_external_user Sys_exterenal_user(
+static Sys_var_external_user Sys_external_user(
        "external_user", "The external user account used when logging in",
        IN_SYSTEM_CHARSET);
 

=== modified file 'sql/sys_vars.h'
--- a/sql/sys_vars.h	2010-10-08 00:56:03 +0000
+++ b/sql/sys_vars.h	2011-01-06 08:00:12 +0000
@@ -842,6 +842,34 @@ public:
 };
 
 /**
+  The class for the @core_file.
+  It's derived from Sys_var_mybool.
+
+  Class specific constructor arguments:
+    Caller need not pass in a variable as we make up the value on the
+    fly, that is, we derive it from the global test_flags bit vector.
+
+  Backing store: my_bool
+*/
+class Sys_var_core_file: public Sys_var_mybool
+{
+private:
+  my_bool core_flag;
+public:
+  Sys_var_core_file(const char *name_arg,
+          const char *comment)
+  : Sys_var_mybool(name_arg, comment, READ_ONLY GLOBAL_VAR(core_flag),
+          NO_CMD_LINE, DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+          0, 0, 0, 0, PARSE_NORMAL)
+  { }
+  uchar *global_value_ptr(THD *thd, LEX_STRING *base)
+  {
+    core_flag= ((test_flags & TEST_CORE_ON_SIGNAL) > 0);
+    return (uchar*) &core_flag;
+  }
+};
+
+/**
   The class for the @max_user_connections.
   It's derived from Sys_var_uint, but non-standard session value
   requires a new class.


Attachment: [text/bzr-bundle] bzr/azundris@sun.com-20110106080012-3yvdzmywqrui3pm1.bundle
Thread
bzr commit into mysql-trunk-merge branch (azundris:3261) Bug#56124Tatiana Azundris Nurnberg6 Jan