mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Major replication test framework cleanup. This does the following:
- Ensure that all tests clean up the replication state when they
finish, by making check-testcase check the output of SHOW SLAVE STATUS.
This implies:
- Slave must not be running after test finished. This is good
because it removes the risk for sporadic errors in subsequent
tests when a test forgets to sync correctly.
- Slave SQL and IO errors must be cleared when test ends. This is
good because we will notice if a test gets an unexpected error in
the slave threads near the end.
- We no longer have to clean up before a test starts.
- Ensure that all tests that wait for an error in one of the slave
threads waits for a specific error. It is no longer possible to
source wait_for_slave_[sql|io]_to_stop.inc when there is an error
in one of the slave threads. This is good because:
- If a test expects an error but there is a bug that causes
another error to happen, or if it stops the slave thread without
an error, then we will notice.
- When developing tests, wait_for_*_to_[start|stop].inc will fail
immediately if there is an error in the relevant slave thread.
Before this patch, we had to wait for the timeout.
- Remove duplicated and repeated code for setting up unusual replication
topologies. Now, there is a single file that is capable of setting
up arbitrary topologies (include/rpl_init.inc, but
include/master-slave.inc is still available for the most common
topology). Tests can now end with include/rpl_end.inc, which will clean
up correctly no matter what topology is used. The topology can be
changed with include/rpl_change_topology.inc.
- Improved debug information when tests fail. This includes:
- debug info is printed on all servers configured by include/rpl_init.inc
- User can set $rpl_debug=1, which makes auxiliary replication files
print relevant debug info.
- Improved documentation for all auxiliary replication files. Now they
describe purpose, usage, parameters, and side effects.
- Many small code cleanups:
- Made have_innodb.inc output a sensible error message.
- Moved contents of rpl000017-slave.sh into rpl000017.test
- Added mysqltest variables that expose the current state of
disable_warnings/enable_warnings and friends.
- Too many to list here: see per-file comments for details.
316 lines
9.8 KiB
Plaintext
316 lines
9.8 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
set binlog_format=row;
|
|
drop table if exists t1;
|
|
"*** Test 1) Test UDFs via loadable libraries ***
|
|
"Running on the master"
|
|
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
|
affected rows: 0
|
|
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
affected rows: 0
|
|
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
myfunc_double 1 UDF_LIB function
|
|
myfunc_int 2 UDF_LIB function
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
myfunc_double 1 UDF_LIB function
|
|
myfunc_int 2 UDF_LIB function
|
|
affected rows: 2
|
|
"Running on the master"
|
|
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
|
|
affected rows: 0
|
|
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
|
|
affected rows: 1
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 48.5
|
|
10 48.75
|
|
100 48.6
|
|
200 49
|
|
affected rows: 4
|
|
"Running on the slave"
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 48.5
|
|
10 48.75
|
|
100 48.6
|
|
200 49
|
|
affected rows: 4
|
|
SELECT myfunc_int(25);
|
|
myfunc_int(25)
|
|
25
|
|
affected rows: 1
|
|
SELECT myfunc_double(75.00);
|
|
myfunc_double(75.00)
|
|
50.00
|
|
affected rows: 1
|
|
"Running on the master"
|
|
DROP FUNCTION myfunc_double;
|
|
affected rows: 0
|
|
DROP FUNCTION myfunc_int;
|
|
affected rows: 0
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
affected rows: 0
|
|
"Running on the slave"
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
affected rows: 0
|
|
"Running on the master"
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
"*** Test 2) Test UDFs with SQL body ***
|
|
"Running on the master"
|
|
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
|
|
affected rows: 0
|
|
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
|
|
test myfuncsql_int FUNCTION i INT RETURN i
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
|
|
test myfuncsql_int FUNCTION i INT RETURN i
|
|
affected rows: 2
|
|
"Running on the master"
|
|
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
|
|
affected rows: 0
|
|
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
|
|
affected rows: 1
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 1000
|
|
10 10
|
|
100 100
|
|
200 50
|
|
affected rows: 4
|
|
"Running on the slave"
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 1000
|
|
10 10
|
|
100 100
|
|
200 50
|
|
affected rows: 4
|
|
"Running on the master"
|
|
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
|
|
affected rows: 0
|
|
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
|
|
test myfuncsql_int FUNCTION i INT RETURN i This was altered.
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
|
|
test myfuncsql_int FUNCTION i INT RETURN i This was altered.
|
|
affected rows: 2
|
|
SELECT myfuncsql_int(25);
|
|
myfuncsql_int(25)
|
|
25
|
|
affected rows: 1
|
|
SELECT myfuncsql_double(75.00);
|
|
myfuncsql_double(75.00)
|
|
150
|
|
affected rows: 1
|
|
"Running on the master"
|
|
DROP FUNCTION myfuncsql_double;
|
|
affected rows: 0
|
|
DROP FUNCTION myfuncsql_int;
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
affected rows: 0
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
affected rows: 0
|
|
"Running on the master"
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
set binlog_format=statement;
|
|
drop table if exists t1;
|
|
"*** Test 1) Test UDFs via loadable libraries ***
|
|
"Running on the master"
|
|
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
|
affected rows: 0
|
|
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
affected rows: 0
|
|
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
myfunc_double 1 UDF_LIB function
|
|
myfunc_int 2 UDF_LIB function
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
myfunc_double 1 UDF_LIB function
|
|
myfunc_int 2 UDF_LIB function
|
|
affected rows: 2
|
|
"Running on the master"
|
|
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
|
|
affected rows: 0
|
|
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
affected rows: 1
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 48.5
|
|
10 48.75
|
|
100 48.6
|
|
200 49
|
|
affected rows: 4
|
|
"Running on the slave"
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 48.5
|
|
10 48.75
|
|
100 48.6
|
|
200 49
|
|
affected rows: 4
|
|
SELECT myfunc_int(25);
|
|
myfunc_int(25)
|
|
25
|
|
affected rows: 1
|
|
SELECT myfunc_double(75.00);
|
|
myfunc_double(75.00)
|
|
50.00
|
|
affected rows: 1
|
|
"Running on the master"
|
|
DROP FUNCTION myfunc_double;
|
|
affected rows: 0
|
|
DROP FUNCTION myfunc_int;
|
|
affected rows: 0
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
affected rows: 0
|
|
"Running on the slave"
|
|
SELECT * FROM mysql.func ORDER BY name;
|
|
name ret dl type
|
|
affected rows: 0
|
|
"Running on the master"
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
"*** Test 2) Test UDFs with SQL body ***
|
|
"Running on the master"
|
|
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
|
|
affected rows: 0
|
|
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
|
|
test myfuncsql_int FUNCTION i INT RETURN i
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
|
|
test myfuncsql_int FUNCTION i INT RETURN i
|
|
affected rows: 2
|
|
"Running on the master"
|
|
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
|
|
affected rows: 0
|
|
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
|
|
affected rows: 1
|
|
INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
|
|
affected rows: 1
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 1000
|
|
10 10
|
|
100 100
|
|
200 50
|
|
affected rows: 4
|
|
"Running on the slave"
|
|
SELECT * FROM t1 ORDER BY sum;
|
|
sum price
|
|
1 1000
|
|
10 10
|
|
100 100
|
|
200 50
|
|
affected rows: 4
|
|
"Running on the master"
|
|
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
|
|
affected rows: 0
|
|
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
|
|
test myfuncsql_int FUNCTION i INT RETURN i This was altered.
|
|
affected rows: 2
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
|
|
test myfuncsql_int FUNCTION i INT RETURN i This was altered.
|
|
affected rows: 2
|
|
SELECT myfuncsql_int(25);
|
|
myfuncsql_int(25)
|
|
25
|
|
affected rows: 1
|
|
SELECT myfuncsql_double(75.00);
|
|
myfuncsql_double(75.00)
|
|
150
|
|
affected rows: 1
|
|
"Running on the master"
|
|
DROP FUNCTION myfuncsql_double;
|
|
affected rows: 0
|
|
DROP FUNCTION myfuncsql_int;
|
|
affected rows: 0
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
affected rows: 0
|
|
"Running on the slave"
|
|
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
|
db name type param_list body comment
|
|
affected rows: 0
|
|
"Running on the master"
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
include/rpl_end.inc
|