1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-28 13:01:41 +03:00
mariadb/mysql-test/t/log_bin_trust_function_creators_func.test
Sven Sandberg 78c8bfdddf BUG#37975: wait_for_slave_* should increase the timeout
Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.
2008-07-10 18:09:39 +02:00

127 lines
4.4 KiB
Plaintext

############## mysql-test\t\log_bin_trust_function_creators_func.test #########
# #
# Variable Name: log_bin_trust_function_creators #
# Scope: GLOBAL | SESSION #
# Access Type: Dynamic #
# Data Type: boolean #
# Default Value: False #
# Range: #
# #
# #
# Creation Date: 2008-03-11 #
# Author: Salman Rawala #
# #
# Description: Test Cases of Dynamic System Variable #
# log_bin_trust_function_creators that checks the functionality #
# of this variable in the following ways #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system #
# -variables.html#option_mysqld_log-bin-trust-function-ceators #
# #
###############################################################################
--disable_warnings
drop table if exists t1;
--enable_warnings
--echo '#--------------------FN_DYNVARS_063_01-------------------------#'
########################################################################
# Setting initial value of variable to 0 and verifying whether user
# is allowed to create function or not.
########################################################################
--echo ## Creating new user tt ##
CREATE user tt@localhost;
--echo ## Setting value of variable to 0 ##
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET @@global.log_bin_trust_function_creators = 0;
--echo ## Creating new table t2 ##
create table t2 (a INT);
--echo ## Creating & connecting with new connection test_con1 ##
connect (test_con1,localhost,tt,,);
connection test_con1;
SELECT @@log_bin_trust_function_creators;
SELECT @@sql_log_bin;
--echo ## Creating new function f1 ##
delimiter |;
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
delimiter ;|
--echo 'Bug: Create Function should give error here because non-super user';
--echo 'is creating function here';
--echo ## Creating new table t1 ##
CREATE TABLE t1 (a INT);
--echo ## Inserting some records in t1 ##
INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
--echo ## Dropping function f1 & table t1 ##
drop function f1;
drop table t1;
--echo '#--------------------FN_DYNVARS_063_02-------------------------#'
########################################################################
# Setting initial value of variable to 1 and verifying whether user
# is allowed to create function or not.
########################################################################
--echo ## Switching to default connection ##
connection default;
--echo ## Setting value of variable to 1 ##
SET @@global.log_bin_trust_function_creators = 1;
--echo ## Creating and connecting to new connection test_con2 ##
connect (test_con2,localhost,tt,,);
connection test_con2;
--echo ## Verifying value of variable ##
SELECT @@log_bin_trust_function_creators;
SELECT @@sql_log_bin;
--echo ## Creating new function f1 ##
delimiter |;
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
delimiter ;|
--echo ## Creating new table t1 ##
CREATE TABLE t1 (a INT);
--echo ## Inserting values in table t1 ##
INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
--echo ## Dropping function f1 ##
drop function f1;
--echo ## Dropping table t1 & t2 ##
drop table t1,t2;
--echo ## Disconnecting both the connections ##
disconnect test_con2;
connection default;
DROP USER tt@localhost;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;