mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
fb8f32d077
The problem was that when a embedded linked version of mysqltest crashed there was no way to obtain a stack trace if no core file is available. Another problem is that the embedded version of libmysql was not behaving (crash) the same as the non-embedded with respect to sending commands to a explicitly closed connection. The solution is to generate a mysqltest's stack trace on crash and to enable "reconnect" if the connection handle was explicitly closed so the behavior matches the non-embedded one. client/CMakeLists.txt: Link mysys to mysqltest. client/Makefile.am: Link mysys to mysqltest. client/mysqltest.c: Add fatal signal handling with backtracing for Unix and Windows. configure.in: Add check for weak symbols support and remove a spurious word. include/Makefile.am: Add new header with prototype for stack tracing functions. include/my_stacktrace.h: Add new header with prototype for stack tracing functions. libmysqld/CMakeLists.txt: stack tracing is now part of mysys. libmysqld/Makefile.am: stack tracing is now part of mysys. libmysqld/lib_sql.cc: Re-connect if connection was explicitly closed. This is done to match the behavior of the non-embeded libmysql. mysql-test/t/sql_low_priority_updates_func.test: Test expects parallelism between queries that cannot be guaranteed under embedded. mysys/CMakeLists.txt: Add stacktrace to mysys. mysys/Makefile.am: Add stacktrace to mysys. mysys/stacktrace.c: Move stacktrace to mysys and add weak symbol for the C++ name de-mangling function so that it can later be overridden in C++ code. Also add my_ prefix to exported functions. sql/CMakeLists.txt: stacktrace was moved to mysys. sql/Makefile.am: stacktrace was moved to mysys. sql/mysqld.cc: Add my_ prefix to mysys functions.
240 lines
5.8 KiB
Text
240 lines
5.8 KiB
Text
############# mysql-test\t\sql_low_priority_updates_func.test #################
|
|
# #
|
|
# Variable Name: sql_low_priority_updates #
|
|
# Scope: GLOBAL & SESSION #
|
|
# Access Type: Dynamic #
|
|
# Data Type: BOOLEAN #
|
|
# Default Value: 1 TRUE #
|
|
# Values: 1 TRUE, 0 FALSE #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-02-25 #
|
|
# Author: Sharique Abdullah #
|
|
# #
|
|
# Description: Test Cases of Dynamic System Variable sql_low_priority_updates#
|
|
# that checks behavior of this variable in the following ways #
|
|
# * Functionality based on different values #
|
|
# #
|
|
# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
|
|
# #
|
|
###############################################################################
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
################################################################
|
|
# sql_low_priority_updates was renamed to low_priority_updates #
|
|
################################################################
|
|
|
|
--echo ** Setup **
|
|
--echo
|
|
#
|
|
# Setup
|
|
#
|
|
--echo ** Connecting con0 using root **
|
|
connect (con0,localhost,root,,);
|
|
--echo ** Connecting con1 using root **
|
|
connect (con1,localhost,root,,);
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
|
|
SET @global_low_priority_updates = @@GLOBAL.low_priority_updates;
|
|
SET @session_low_priority_updates = @@SESSION.low_priority_updates;
|
|
|
|
#
|
|
# Create Table
|
|
#
|
|
|
|
CREATE TABLE t1 (a varchar(100));
|
|
|
|
--echo '#--------------------FN_DYNVARS_160_01-------------------------#'
|
|
#
|
|
# Value ON
|
|
#
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
SET SESSION low_priority_updates = ON;
|
|
--echo ** Connection con1 **
|
|
connection con1;
|
|
SET SESSION low_priority_updates = ON;
|
|
--echo ** Connection default **
|
|
connection default;
|
|
SET SESSION low_priority_updates = ON;
|
|
|
|
INSERT INTO t1 VALUES('1');
|
|
INSERT INTO t1 VALUES('2');
|
|
INSERT INTO t1 VALUES('3');
|
|
INSERT INTO t1 VALUES('4');
|
|
INSERT INTO t1 VALUES('5');
|
|
INSERT INTO t1 VALUES('6');
|
|
|
|
LOCK TABLE t1 WRITE;
|
|
|
|
--echo ** Connection con1 **
|
|
connection con1;
|
|
|
|
--echo ** Asynchronous Execution **
|
|
delimiter |;
|
|
|
|
send
|
|
UPDATE t1 SET a = CONCAT(a,"-updated");|
|
|
|
|
delimiter ;|
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
|
|
--echo ** Asynchronous Execution **
|
|
delimiter |;
|
|
|
|
send
|
|
LOCK TABLE t1 READ;
|
|
SELECT * FROM t1;
|
|
UNLOCK TABLES;|
|
|
|
|
delimiter ;|
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
|
|
--echo Sleeping for 1 secs
|
|
--sleep 1
|
|
|
|
UNLOCK TABLES;
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
--echo ** Asynchronous Result **
|
|
reap;
|
|
|
|
--echo Expected values of a without -updated;
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
|
|
DELETE FROM t1;
|
|
|
|
--echo '#--------------------FN_DYNVARS_160_02-------------------------#'
|
|
#
|
|
# Value ON
|
|
#
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
SET SESSION low_priority_updates = OFF;
|
|
--echo ** Connection con1 **
|
|
connection con1;
|
|
SET SESSION low_priority_updates = OFF;
|
|
--echo ** Connection default**
|
|
connection default;
|
|
SET SESSION low_priority_updates = OFF;
|
|
|
|
INSERT INTO t1 VALUES('1');
|
|
INSERT INTO t1 VALUES('2');
|
|
INSERT INTO t1 VALUES('3');
|
|
INSERT INTO t1 VALUES('4');
|
|
INSERT INTO t1 VALUES('5');
|
|
INSERT INTO t1 VALUES('6');
|
|
|
|
LOCK TABLE t1 WRITE;
|
|
|
|
--echo ** Connection con1 **
|
|
connection con1;
|
|
|
|
--echo ** Asynchronous Execution **
|
|
delimiter |;
|
|
|
|
send
|
|
UPDATE t1 SET a = CONCAT(a,"-updated");|
|
|
|
|
delimiter ;|
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
|
|
--echo ** Asynchronous Execution **
|
|
delimiter |;
|
|
|
|
send
|
|
LOCK TABLE t1 READ;
|
|
SELECT * FROM t1;
|
|
UNLOCK TABLES;|
|
|
|
|
delimiter ;|
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
|
|
--echo Sleeping for 1 secs
|
|
--sleep 1
|
|
|
|
UNLOCK TABLES;
|
|
|
|
--echo ** Connection con0 **
|
|
connection con0;
|
|
--echo ** Asynchronous Result **
|
|
reap;
|
|
--echo Expected values of a with -updated;
|
|
|
|
--echo ** Connection default**
|
|
connection default;
|
|
|
|
DELETE FROM t1;
|
|
|
|
--echo '#--------------------FN_DYNVARS_160_03-------------------------#'
|
|
#
|
|
# Session data integrity check & GLOBAL Value check
|
|
#
|
|
|
|
--echo ** Connecting con_int1 using root **
|
|
connect (con_int1,localhost,root,,);
|
|
|
|
--echo ** Connection con_int1 **
|
|
connection con_int1;
|
|
SELECT @@SESSION.low_priority_updates;
|
|
--echo 1 / TRUE Expected
|
|
|
|
SET SESSION low_priority_updates = FALSE;
|
|
|
|
--echo ** Connecting con_int2 using root **
|
|
connect (con_int2,localhost,root,,);
|
|
|
|
--echo ** Connection con_int2 **
|
|
connection con_int2;
|
|
SELECT @@SESSION.low_priority_updates;
|
|
--echo 1 / TRUE Expected
|
|
|
|
SET SESSION low_priority_updates = TRUE;
|
|
|
|
--echo ** Connection con_int1 **
|
|
connection con_int1;
|
|
SELECT @@SESSION.low_priority_updates;
|
|
--echo 0 / FALSE Expected
|
|
|
|
--echo ** Connection con_int2 **
|
|
connection con_int2;
|
|
SELECT @@SESSION.low_priority_updates;
|
|
--echo 1 / TRUE Expected
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
|
|
--echo Disconnecting Connections con_int1, con_int2
|
|
disconnect con_int1;
|
|
disconnect con_int2;
|
|
|
|
#
|
|
# Cleanup
|
|
#
|
|
|
|
--echo ** Connection default **
|
|
connection default;
|
|
--echo Disconnecting Connections con0, con1
|
|
disconnect con0;
|
|
disconnect con1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET @@GLOBAL.low_priority_updates = @global_low_priority_updates;
|
|
SET @@SESSION.low_priority_updates = @session_low_priority_updates;
|