Commit e730c916 authored by Jan Lindström's avatar Jan Lindström

Added test case for new system variable innodb_use_stacktrace and made sure...

Added test case for new system variable innodb_use_stacktrace and made sure that it can be used only on startup. Fixed compiler problems on solaris and other platforms that do not contain necessary headers and functions.
parent 338587d2
......@@ -10,6 +10,5 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
innodb_use_stacktrace
drop table t1;
drop table t2;
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
COUNT(@@GLOBAL.innodb_use_stacktrace)
1
1 Expected
SET @@GLOBAL.innodb_use_stacktrace=1;
ERROR HY000: Variable 'innodb_use_stacktrace' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
COUNT(@@GLOBAL.innodb_use_stacktrace)
1
1 Expected
SELECT IF(@@GLOBAL.innodb_use_stacktrace, 'ON', 'OFF') = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_use_stacktrace';
IF(@@GLOBAL.innodb_use_stacktrace, 'ON', 'OFF') = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
COUNT(@@GLOBAL.innodb_use_stacktrace)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_use_stacktrace';
COUNT(VARIABLE_VALUE)
1
1 Expected
SELECT @@innodb_use_stacktrace = @@GLOBAL.innodb_use_stacktrace;
@@innodb_use_stacktrace = @@GLOBAL.innodb_use_stacktrace
1
1 Expected
SELECT COUNT(@@innodb_use_stacktrace);
COUNT(@@innodb_use_stacktrace)
1
1 Expected
SELECT COUNT(@@local.innodb_use_stacktrace);
ERROR HY000: Variable 'innodb_use_stacktrace' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.innodb_use_stacktrace);
ERROR HY000: Variable 'innodb_use_stacktrace' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
COUNT(@@GLOBAL.innodb_use_stacktrace)
1
1 Expected
SELECT innodb_use_stacktrace = @@SESSION.innodb_use_stacktrace;
ERROR 42S22: Unknown column 'innodb_use_stacktrace' in 'field list'
Expected error 'Readonly variable'
--source include/have_xtradb.inc
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
--echo 1 Expected
####################################################################
# Check if Value can set #
####################################################################
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.innodb_use_stacktrace=1;
--echo Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
--echo 1 Expected
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT IF(@@GLOBAL.innodb_use_stacktrace, 'ON', 'OFF') = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_use_stacktrace';
--echo 1 Expected
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_use_stacktrace';
--echo 1 Expected
################################################################################
# Check if accessing variable with and without GLOBAL point to same variable #
################################################################################
SELECT @@innodb_use_stacktrace = @@GLOBAL.innodb_use_stacktrace;
--echo 1 Expected
SELECT COUNT(@@innodb_use_stacktrace);
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.innodb_use_stacktrace);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.innodb_use_stacktrace);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_use_stacktrace);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT innodb_use_stacktrace = @@SESSION.innodb_use_stacktrace;
--echo Expected error 'Readonly variable'
......@@ -13473,8 +13473,8 @@ static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks,
NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(use_stacktrace, srv_use_stacktrace,
PLUGIN_VAR_OPCMDARG,
"Print stacktrace on long semaphore wait (off by default)",
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Print stacktrace on long semaphore wait (off by default supported only on linux)",
NULL, NULL, FALSE);
static struct st_mysql_sys_var* innobase_system_variables[]= {
......
......@@ -20,8 +20,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
#ifndef os0stacktrace_h
#define os0stacktrace_h
#ifndef __WIN__
#ifdef __linux__
#if HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -38,5 +40,5 @@ os_stacktrace_print(
siginfo_t* info, /*!< in: signal information */
void* ucontext);/*!< in: signal context */
#endif /* ! __WIN__ */
#endif /* __linux__ */
#endif /* os0stacktrace.h */
......@@ -19,9 +19,12 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "os0thread.h"
#ifdef __linux__
#if defined (__linux__) && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
#if HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
......
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