Skip to content

Commit 38936c6

Browse files
committed
Merge branch 'mysql-5.6' into mysql-5.7
2 parents 5abf19d + 70bb88e commit 38936c6

20 files changed

+717
-67
lines changed

mysql-test/include/escape_sql.inc

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# ==== Purpose ====
2+
#
3+
# Escape occurences of " or ' in a string, in order to be used inside
4+
# an SQL statement.
5+
#
6+
# ==== Usage ====
7+
#
8+
# --let $escape_string= String
9+
# [--let $enclosing_char= "|' (default is ")]
10+
# --source include/escape_sql.inc
11+
# --echo $escape_string
12+
#
13+
# Parameters:
14+
# $escape_string
15+
# String to search for occurences of the $enclosing_char and
16+
# escape them according to SQL syntax. It is also the output
17+
# parameter.
18+
19+
# $enclosing_char
20+
# The character that will be used to enclose $escape_string when
21+
# included in an SQL statement.
22+
#
23+
24+
if (!$escape_string)
25+
{
26+
--die Error: set $escape_string before sourcing escape_sql.inc
27+
}
28+
29+
if ($escape_string != '')
30+
{
31+
--let $_enclosing_char= "
32+
if ($enclosing_char)
33+
{
34+
--let $_enclosing_char= $enclosing_char
35+
}
36+
37+
38+
--let $_output_filename= `SELECT UUID()`
39+
--let $_output_filename= $MYSQLTEST_VARDIR/tmp/$_output_filename
40+
--let full_output_filename= $_output_filename
41+
--let to_replace= $escape_string
42+
--let used_quote= $_enclosing_char
43+
44+
perl;
45+
my $out= $ENV{'full_output_filename'};
46+
my $to_replace= $ENV{'to_replace'};
47+
my $quote= $ENV{'used_quote'};
48+
49+
$to_replace =~ s/$quote/$quote$quote/g;
50+
51+
open(FILE, ">", $out) or die "Error $? opening $output_filename: $!";
52+
print FILE $to_replace or die "Error $? writing to $output_filename: $!";
53+
close FILE or die "Error $? closing $output_filename: $!";
54+
chmod 0777, $out;
55+
EOF
56+
57+
--let $escape_string= `SELECT LOAD_FILE('$_output_filename')`
58+
}
59+
# Cleanup
60+
--remove_file $_output_filename

mysql-test/include/show_slave_status.inc

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ while ($_show_slave_status_items)
100100
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
101101

102102
--let $_show_slave_status_value= query_get_value($show_slave_status_cmd, $_show_slave_status_name, 1)
103+
104+
if ($_show_slave_status_value)
105+
{
106+
--let $escape_string= $_show_slave_status_value
107+
--let $enclosing_char= "
108+
--source include/escape_sql.inc
109+
--let $_show_slave_status_value= $escape_string
110+
}
111+
103112
--let $_slave_field_result_replace= /[\\]/\// $slave_field_result_replace
104113
--replace_regex $_slave_field_result_replace
105114
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#
2+
# 1) Create a master-slave setup.
3+
#
4+
include/master-slave.inc
5+
Warnings:
6+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
7+
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.
8+
[connection master]
9+
#
10+
# 2) Create a table on master, sync it, stop the slave threads and dump
11+
# thread on master.
12+
#
13+
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
14+
include/sync_slave_sql_with_master.inc
15+
include/stop_slave.inc
16+
[connection master]
17+
include/stop_dump_threads.inc
18+
#
19+
# 3) On master, generate a transaction, flush the binary log and delete
20+
# the first binary logs so that only remaining binlog only contains
21+
# transaction UUID:3.
22+
#
23+
INSERT INTO t1 VALUES (1);
24+
FLUSH LOGS;
25+
INSERT INTO t1 VALUES (2);
26+
#
27+
# 4) Verify that the slave fails if it tries to connect using CHANGE
28+
# MASTER TO MASTER_AUTO_POSITION=1.
29+
#
30+
[connection slave]
31+
CHANGE MASTER TO MASTER_AUTO_POSITION = 1;
32+
START SLAVE;
33+
include/wait_for_slave_io_error.inc [errno=1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG]
34+
include/stop_slave_sql.inc
35+
#
36+
# 5) Verify that appropriate messages are logged into master's and slave's
37+
# error log.
38+
#
39+
include/assert_grep.inc [Found warning containing lost GTIDs in the master error log.]
40+
include/assert_grep.inc [Found warning containing lost GTIDs in the slave error log.]
41+
#
42+
# 6) Verify that replication succeeds if it tries to connect using CHANGE
43+
# MASTER TO MASTER_LOG_POS.
44+
#
45+
CHANGE MASTER TO MASTER_LOG_FILE = 'MASTER_FILE', MASTER_LOG_POS = MASTER_POS, MASTER_AUTO_POSITION = 0;
46+
include/start_slave.inc
47+
include/assert.inc [t1 should contain only one row with the value 2]
48+
include/stop_slave.inc
49+
[connection master]
50+
CALL mtr.add_suppression("Cannot replicate to server.*server has purged required binary logs.*");
51+
CALL mtr.add_suppression("Failed to open log");
52+
CALL mtr.add_suppression("Could not open log");
53+
[connection slave]
54+
CALL mtr.add_suppression("Got fatal error 1236 from master.*Replicate the missing transactions from elsewhere");
55+
#
56+
# 7) Cleanup.
57+
#
58+
RESET MASTER;
59+
RESET SLAVE;
60+
[connection master]
61+
RESET MASTER;
62+
Warnings:
63+
Warning 1612 Being purged log ./master-bin.000001 was not found
64+
[connection slave]
65+
include/start_slave.inc
66+
[connection master]
67+
DROP TABLE t1;
68+
include/sync_slave_sql_with_master.inc
69+
include/rpl_end.inc
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,80 @@
1+
#
2+
# 1) Create a master-slave setup.
3+
#
14
include/master-slave.inc
25
Warnings:
36
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
47
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.
58
[connection master]
6-
call mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.");
7-
######## Initialize ########
9+
#
10+
# 2) Create a table on master, sync it, stop the slave threads and dump
11+
# thread on master.
12+
#
813
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
914
include/sync_slave_sql_with_master.inc
1015
include/stop_slave.inc
16+
[connection master]
1117
include/stop_dump_threads.inc
18+
#
19+
# 3) On master, generate a transaction, flush the binary log and execute
20+
# PURGE BINARY LOGS TO command so that only remaining binlog only contains
21+
# transaction UUID:3.
22+
#
1223
INSERT INTO t1 VALUES (1);
1324
FLUSH LOGS;
1425
INSERT INTO t1 VALUES (2);
1526
PURGE BINARY LOGS TO 'master-bin.000002';
16-
include/assert.inc [PURGE BINARY LOGS successfully removed all but the latest files]
17-
INSERT INTO t1 VALUES (2);
27+
include/assert.inc [PURGE BINARY LOGS successfully removed all but the latest file]
28+
#
29+
# 4) Verify that the slave fails if it tries to connect using CHANGE
30+
# MASTER TO MASTER_AUTO_POSITION=1.
31+
#
32+
[connection slave]
1833
CHANGE MASTER TO MASTER_AUTO_POSITION = 1;
1934
START SLAVE;
2035
include/wait_for_slave_io_error.inc [errno=1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG]
2136
include/stop_slave_sql.inc
22-
CHANGE MASTER TO MASTER_LOG_FILE = 'master-bin.000002', MASTER_LOG_POS = MASTER_POS, MASTER_AUTO_POSITION = 0;
37+
[connection master]
38+
SET @saved_debug= @@GLOBAL.DEBUG;
39+
SET GLOBAL DEBUG= '+d,simulate_long_missing_gtids';
40+
[connection slave]
41+
START SLAVE;
42+
include/wait_for_slave_io_error.inc [errno=1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG]
43+
include/stop_slave_sql.inc
44+
[connection master]
45+
SET GLOBAL DEBUG= @saved_debug;
46+
[connection slave]
47+
#
48+
# 5) Verify that appropriate messages are logged into master's and slave's
49+
# error log.
50+
#
51+
include/assert_grep.inc [Found the suggestions to extract the missing GTIDs in the master error log.]
52+
include/assert_grep.inc [Found a message about the long GTIDs in the slave error log.]
53+
#
54+
# 6) Verify that replication succeeds if it tries to connect using CHANGE
55+
# MASTER TO MASTER_LOG_POS.
56+
#
57+
CHANGE MASTER TO MASTER_LOG_FILE = 'MASTER_FILE', MASTER_LOG_POS = MASTER_POS, MASTER_AUTO_POSITION = 0;
2358
include/start_slave.inc
2459
include/assert.inc [t1 should contain only one row with the value 2]
25-
######## Clean up ########
26-
=== Stop and reset slave/master (connection slave) ====
60+
include/assert_grep.inc [Found warning containing lost GTIDs in the master error log.]
61+
include/assert_grep.inc [Found warning containing lost GTIDs in the slave error log.]
62+
[connection master]
63+
CALL mtr.add_suppression("Cannot replicate to server.*server has purged required binary logs.*");
64+
[connection slave]
65+
CALL mtr.add_suppression("Got fatal error 1236 from master.*Replicate the missing transactions from elsewhere");
66+
#
67+
# 7) Cleanup.
68+
#
69+
[connection slave]
2770
include/stop_slave.inc
2871
RESET MASTER;
2972
RESET SLAVE;
30-
=== Stop and reset master (connection master) ====
73+
[connection master]
3174
RESET MASTER;
32-
=== Start slave (connection slave) ====
75+
[connection slave]
3376
include/start_slave.inc
34-
=== Sync slave with master (connection master/slave) ====
77+
[connection master]
3578
DROP TABLE t1;
3679
include/sync_slave_sql_with_master.inc
3780
include/rpl_end.inc

mysql-test/suite/rpl/r/rpl_gtid_validate_slave_gtids.result

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ START SLAVE IO_THREAD;
1010
include/wait_for_slave_io_error.inc [errno=1236]
1111
Warnings:
1212
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
13-
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.''
13+
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. The GTID set sent by the slave is '', and the missing transactions are 'MASTER_UUID:1-2'.''
1414
Warnings:
1515
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
1616
SET GLOBAL GTID_PURGED= "master_uuid:1-2";
1717
include/start_slave.inc
1818
include/sync_slave_sql_with_master.inc
1919
include/assert.inc [Slave should be able to get GTID-3 and 4 now.]
20-
call mtr.add_suppression(".*Master has purged binary logs containing GTIDs that the slave requires.*");
20+
CALL mtr.add_suppression(".*Cannot replicate.*purged required binary logs.*");
21+
CALL mtr.add_suppression(".*Master has purged binary logs containing GTIDs that the slave requires.*");
22+
include/assert_grep.inc [Found warning continaining lost GTIDs]
2123
include/rpl_reset.inc
2224
CREATE TABLE t1(i INT);
2325
DROP TABLE t1;
@@ -31,7 +33,7 @@ START SLAVE IO_THREAD;
3133
include/wait_for_slave_io_error.inc [errno=1236]
3234
Warnings:
3335
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
34-
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave has more GTIDs than the master has, using the master's SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replica''
36+
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave has more GTIDs than the master has, using the master's SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been''
3537
Warnings:
3638
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
3739
call mtr.add_suppression(".*Slave has more GTIDs than the master has.*");

mysql-test/suite/rpl/r/rpl_replication_observers_example_is_stopping.result

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Note #### Storing MySQL user name or password information in the master info rep
77

88
############################################################
99
# 1. Install the plug-in and add error suppressions on slave
10+
[connection master]
11+
SET SESSION sql_log_bin= 0;
12+
CALL mtr.add_suppression(".*Cannot replicate.*purged required binary logs.*");
13+
SET SESSION sql_log_bin= 1;
1014
[connection slave]
1115
SET SESSION sql_log_bin= 0;
1216
CALL mtr.add_suppression("Table 't1' already exists");

0 commit comments

Comments
 (0)