Skip to content

Commit d16e612

Browse files
committed
Bring back four recent tests
The fact that we're getting 1-2 completely different failures per build suggests the underlying problem isn't these tests.
1 parent 07e78f3 commit d16e612

8 files changed

+1805
-0
lines changed

mysql-test/suite/innodb/r/trigger_function_lock_compare.result

Lines changed: 534 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
--echo #
2+
--echo # BUG#32636792: IN THE TRIGGER, INSERT INTO SELECT LOCKS THE SELECTED
3+
--echo # ROWS, EVEN READ-COMMITTED
4+
--echo #
5+
6+
--disable_query_log
7+
SET @saved_binlog_format= @@GLOBAL.binlog_format;
8+
CREATE TABLE cases (
9+
id INT PRIMARY KEY AUTO_INCREMENT,
10+
statements TEXT NOT NULL
11+
);
12+
INSERT INTO cases (statements) VALUES
13+
("SELECT id FROM t1 WHERE val = 'a' INTO @v1"),
14+
("SELECT id FROM t1 WHERE val = 'a' FOR SHARE INTO @v1"),
15+
("SELECT id FROM t1 WHERE val = 'a' FOR UPDATE INTO @v1"),
16+
("UPDATE t1 SET val='A' WHERE val = 'a'"),
17+
("INSERT INTO t1 SELECT id+100,val FROM t2"),
18+
("INSERT INTO t1 ( id, val ) SELECT 2, id FROM t1 WHERE val = 'a'"),
19+
("REPLACE INTO t1 ( id, val ) SELECT 2, id FROM t1 WHERE val = 'a'"),
20+
("INSERT INTO t1 VALUES (30, 'b');
21+
UPDATE t2 SET val='c' WHERE val IN (SELECT val FROM t1 where id = 30)"),
22+
("INSERT INTO t1 VALUES (2, 'A');
23+
SELECT val FROM t1 WHERE id = 10 INTO @v1");
24+
25+
26+
--let $binlog_formats=ROW,STATEMENT
27+
while ($binlog_formats)
28+
{
29+
--let $binlog_format= `SELECT SUBSTRING_INDEX('$binlog_formats', ',', 1)`
30+
--let $binlog_formats= `SELECT SUBSTRING('$binlog_formats', LENGTH('$binlog_format') + 2)`
31+
--eval SET GLOBAL BINLOG_FORMAT='$binlog_format'
32+
--echo ########## BINLOG FORMAT: $binlog_format ###########
33+
34+
--let $cases_cnt = `SELECT COUNT(1) FROM cases`
35+
--let $case_id = 1
36+
while($case_id <= $cases_cnt)
37+
{
38+
--let $statements = `SELECT statements FROM cases WHERE id = $case_id`
39+
--echo # Query: $statements
40+
--source include/trigger_function_lock_compare.inc
41+
--inc $case_id
42+
}
43+
}
44+
45+
# Because of Bug#33307684, under REPEATABLE READ, the below queries have a
46+
# discrepancy in the locks taken when executed inside a stored function. Hence
47+
# skipping the lock comparison.
48+
49+
TRUNCATE TABLE cases;
50+
INSERT INTO cases (statements) VALUES
51+
("INSERT INTO t2 SELECT id+100,val FROM t1"),
52+
("CREATE TEMPORARY TABLE t3 SELECT id FROM t1;
53+
DROP TEMPORARY TABLE t3");
54+
55+
--let $binlog_formats=ROW,STATEMENT
56+
while ($binlog_formats)
57+
{
58+
--let $binlog_format= `SELECT SUBSTRING_INDEX('$binlog_formats', ',', 1)`
59+
--let $binlog_formats= `SELECT SUBSTRING('$binlog_formats', LENGTH('$binlog_format') + 2)`
60+
--eval SET GLOBAL BINLOG_FORMAT='$binlog_format'
61+
--echo ########## BINLOG FORMAT: $binlog_format ###########
62+
63+
--let $cases_cnt = `SELECT COUNT(1) FROM cases`
64+
--let $case_id = 1
65+
--let $skip_lock_check = 1
66+
while($case_id <= $cases_cnt)
67+
{
68+
--let $statements = `SELECT statements FROM cases WHERE id = $case_id`
69+
--echo # Query: $statements
70+
--source include/trigger_function_lock_compare.inc
71+
--inc $case_id
72+
}
73+
}
74+
75+
# Cleanup
76+
DROP TABLE cases;
77+
SET GLOBAL BINLOG_FORMAT=@saved_binlog_format;
78+
# Remove this when Bug#33594199 has been fixed
79+
RESET MASTER;
80+
--enable_query_log
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY = 1, SOURCE_RETRY_COUNT = 1;
7+
#### Test 1: invalid credentials ####
8+
[connection slave]
9+
CHANGE REPLICATION SOURCE TO SOURCE_USER = 'foo';
10+
Warnings:
11+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
12+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
13+
START SLAVE IO_THREAD;
14+
Warnings:
15+
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
16+
include/wait_for_slave_io_error.inc [errno=1045]
17+
---- Check performance_schema ----
18+
include/assert.inc [Error should contain the reason (Access denied for user foo) for connection failure]
19+
---- Check SHOW SLAVE STATUS ----
20+
include/assert.inc [Error should contain the reason (Access denied for user foo) for connection failure]
21+
---- Check that messages are the same in both places ----
22+
include/assert.inc [Error should be the same in both SSS and P_S]
23+
#### Test 2: invalid port ####
24+
[connection slave]
25+
CHANGE REPLICATION SOURCE TO SOURCE_PORT = 1;
26+
START SLAVE IO_THREAD;
27+
Warnings:
28+
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
29+
include/wait_for_slave_io_error.inc [errno=2003 # CR_CONN_HOST_ERROR]
30+
---- Check performance_schema ----
31+
include/assert.inc [Error should contain the reason (Cant connect to MySQL server on) for connection failure]
32+
---- Check SHOW SLAVE STATUS ----
33+
include/assert.inc [Error should contain the reason (Cant connect to MySQL server on) for connection failure]
34+
---- Check that messages are the same in both places ----
35+
include/assert.inc [Error should be the same in both SSS and P_S]
36+
#### Test 3: invalid host ####
37+
[connection slave]
38+
CHANGE REPLICATION SOURCE TO SOURCE_HOST = '999.999.999.999';
39+
START SLAVE IO_THREAD;
40+
Warnings:
41+
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
42+
include/wait_for_slave_io_error.inc [errno=2005 # CR_UNKNOWN_HOST]
43+
---- Check performance_schema ----
44+
include/assert.inc [Error should contain the reason (Unknown MySQL server host) for connection failure]
45+
---- Check SHOW SLAVE STATUS ----
46+
include/assert.inc [Error should contain the reason (Unknown MySQL server host) for connection failure]
47+
---- Check that messages are the same in both places ----
48+
include/assert.inc [Error should be the same in both SSS and P_S]
49+
#### Clean up ####
50+
RESET SLAVE;
51+
Warnings:
52+
Warning 1287 'RESET SLAVE' is deprecated and will be removed in a future release. Please use RESET REPLICA instead
53+
CHANGE REPLICATION SOURCE TO SOURCE_HOST = '127.0.0.1', SOURCE_PORT = PORT, SOURCE_USER = 'root';
54+
Warnings:
55+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
56+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
57+
include/start_slave.inc
58+
include/rpl_end.inc
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# ==== Requirements ====
2+
#
3+
# R1. When slave fails to connect to master, the error message shown in
4+
# performance_schema.replication_connection_status/LAST_ERROR_MESSAGE,
5+
# and in SHOW SLAVE STATUS/LAST_IO_ERROR, should contain the reason
6+
# for the failure.
7+
#
8+
# R2. When slave fails to connect to master, the messages in
9+
# performance_schema.replication_connection_status/LAST_ERROR_MESSAGE,
10+
# and in SHOW SLAVE STATUS/LAST_IO_ERROR, should both be identical.
11+
#
12+
# ==== Implementation ====
13+
#
14+
# 1. Try to connect using a non-existing user.
15+
# 2. Try to connect on an invalid port.
16+
# 3. Try to connect to a non-existing host.
17+
#
18+
# In each of the cases:
19+
# - Verify that the error message in performance_schema contains
20+
# 'Access denied'/'Cant connect to MySQL'/'Unknown MySQL server host'
21+
# - Verify that the error message in SHOW SLAVE STATUS contains the same.
22+
#
23+
# ==== References ====
24+
#
25+
# BUG#26580064 CONFUSING ERROR MESSAGE IN REPLICATION WHEN CONNECTING WITH MASTER
26+
27+
# Test should only run once.
28+
--source include/have_binlog_format_row.inc
29+
--let $rpl_skip_start_slave = 1
30+
--source include/master-slave.inc
31+
32+
33+
# Verify that the message has the expected form.
34+
#
35+
# This asserts that $message contains $expected_message,
36+
# but ignores single quotes, numbers, and dots.
37+
#
38+
# Usage:
39+
# --let $message = "message text from mysql server"
40+
# --let $expected_message = "the text that we expect to see"
41+
# --source $script_dir/check_message.inc
42+
43+
--let $script_dir = $MYSQLTEST_VARDIR
44+
--write_file $script_dir/check_message.inc
45+
if ($message == '') {
46+
--die !!!ERROR IN TEST: you must set $message
47+
}
48+
if ($expected_message == '') {
49+
--die !!!ERROR IN TEST: you must set $expected_message
50+
}
51+
# Remove quotes (which confuse assert.inc) from the message.
52+
--let $message_noquotes = `SELECT REPLACE("$message", "'", '')`
53+
# Remove numbers (which are nondeterministic) from the message.
54+
--let $message_nonumbers = `SELECT REGEXP_REPLACE("$message_noquotes", "[0-9\.]*", '')`
55+
--let $assert_cond = "$message_nonumbers" LIKE "%$expected_message%"
56+
--let $assert_text = Error should contain the reason ($expected_message) for connection failure
57+
--source include/assert.inc
58+
EOF
59+
60+
# Check messages in both performance_schema and SHOW SLAVE STATUS.
61+
#
62+
# This will check that the receiver error in performance_schema and
63+
# SHOW SLAVE STATUS contains $expected_message. It also checks that
64+
# both performance_schema and SHOW SLAVE STATUS contain literally the
65+
# same message.
66+
#
67+
# Usage:
68+
# --let $expected_message = "the text that we expect to see"
69+
# --source $script_dir/check_both_messages.inc
70+
#
71+
# Side effects:
72+
# - Sets $message_noquotes to the message with quotes removed.
73+
--write_file $script_dir/check_both_messages.inc
74+
if ($expected_message == '') {
75+
--die !!!ERROR IN TEST: you must set $expected_message
76+
}
77+
START SLAVE IO_THREAD;
78+
--source include/wait_for_slave_io_error.inc
79+
80+
--echo ---- Check performance_schema ----
81+
82+
--let $message = `SELECT LAST_ERROR_MESSAGE FROM performance_schema.replication_connection_status`
83+
# Remove quotes since they confuse assert.inc
84+
--source $script_dir/check_message.inc
85+
--let $message_ps = $message_noquotes
86+
87+
--echo ---- Check SHOW SLAVE STATUS ----
88+
89+
--let $message = query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1)
90+
--source $script_dir/check_message.inc
91+
--let $message_sss = $message_noquotes
92+
93+
--echo ---- Check that messages are the same in both places ----
94+
95+
--let $assert_cond = "$message_ps" = "$message_sss"
96+
--let $assert_text = Error should be the same in both SSS and P_S
97+
--source include/assert.inc
98+
EOF
99+
100+
CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY = 1, SOURCE_RETRY_COUNT = 1;
101+
102+
103+
--echo #### Test 1: invalid credentials ####
104+
105+
--source include/rpl_connection_slave.inc
106+
CHANGE REPLICATION SOURCE TO SOURCE_USER = 'foo';
107+
--let $slave_io_errno = convert_error(ER_ACCESS_DENIED_ERROR)
108+
--let $expected_message = Access denied for user foo
109+
--source $script_dir/check_both_messages.inc
110+
111+
112+
--echo #### Test 2: invalid port ####
113+
114+
--source include/rpl_connection_slave.inc
115+
CHANGE REPLICATION SOURCE TO SOURCE_PORT = 1;
116+
--let $slave_io_errno = 2003 # CR_CONN_HOST_ERROR
117+
--let $expected_message = Cant connect to MySQL server on
118+
--source $script_dir/check_both_messages.inc
119+
120+
121+
--echo #### Test 3: invalid host ####
122+
123+
--source include/rpl_connection_slave.inc
124+
CHANGE REPLICATION SOURCE TO SOURCE_HOST = '999.999.999.999';
125+
--let $slave_io_errno = 2005 # CR_UNKNOWN_HOST
126+
--let $expected_message = Unknown MySQL server host
127+
--source $script_dir/check_both_messages.inc
128+
129+
130+
--echo #### Clean up ####
131+
132+
RESET SLAVE;
133+
--remove_file $script_dir/check_message.inc
134+
--remove_file $script_dir/check_both_messages.inc
135+
--replace_result $MASTER_MYPORT PORT
136+
eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = '127.0.0.1', SOURCE_PORT = $MASTER_MYPORT, SOURCE_USER = 'root';
137+
--source include/start_slave.inc
138+
139+
--source include/rpl_end.inc

0 commit comments

Comments
 (0)