Merge lp:~vlad-lesin/percona-server/5.6-bugs-1268729-1268735 into lp:percona-server/5.6

Proposed by Vlad Lesin
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 554
Proposed branch: lp:~vlad-lesin/percona-server/5.6-bugs-1268729-1268735
Merge into: lp:percona-server/5.6
Diff against target: 180 lines (+126/-2)
4 files modified
mysql-test/suite/rpl/r/rpl_percona_gmvac_net_err.result (+33/-0)
mysql-test/suite/rpl/t/rpl_percona_gmvac_net_err.test (+67/-0)
sql-common/client.c (+6/-0)
sql/rpl_slave.cc (+20/-2)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.6-bugs-1268729-1268735
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+204786@code.launchpad.net

Description of the change

Bug #1268735 fixing is merged from 5.5.

The difference between 5.5 and this patches is the following:

      if (is_network_error(mysql_errno(mysql)))
      {
        mi->report(WARNING_LEVEL, mysql_errno(mysql),
                   "SET @master_heartbeat_period to master failed with error: %s",
                   mysql_error(mysql));
        mysql_free_result(mysql_store_result(mysql));
        goto network_err;
      }
- else if (!check_io_slave_killed(mi->io_thd, mi, NULL)) {
+ else {
        errmsg= "The slave I/O thread stops because SET @master_heartbeat_period "
          "on master failed.";
        err_code= ER_SLAVE_FATAL_ERROR;
        sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
        mysql_free_result(mysql_store_result(mysql));
        goto err;
      }

The initial code checked if the slave thread was killed in the case if there
was error in mysql_real_query(). To save this logic non-network error in
mysql_real_query() is treated as fatal error only if the slave thread was
not killed in 5.5. But as 5.6 upstream fix (see upstream revno: 2661.723.1)
does not contain this check it was decided do not include it in PS-5.6.

The fix for bug #1268729 merged from 5.5:
Slave I/O thread won't attempt to automatically reconnect to the master.

The fix is in including ER_NET_READ_INTERRUPTED error code to the set of
network related error codes in is_network_error() function.

The test case tests a couple of cases when get_master_version_and_clock()
fails due to ER_NET_READ_INTERRUPTED network error.

There are no big differences between 5.6 and 5.5 fixes.

http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/498

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Needs Fixing
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

ST 38489

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'mysql-test/suite/rpl/r/rpl_percona_gmvac_net_err.result'
--- mysql-test/suite/rpl/r/rpl_percona_gmvac_net_err.result 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/rpl/r/rpl_percona_gmvac_net_err.result 2014-02-27 16:24:37 +0000
@@ -0,0 +1,33 @@
1include/master-slave.inc
2Warnings:
3Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4Note #### 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]
6call mtr.add_suppression("Slave I/O: Get master clock failed with error: , Error_code: 1159");
7call mtr.add_suppression("Get master SERVER_ID failed with error: , Error_code: 1159");
8call mtr.add_suppression("Slave I/O: SET @master_heartbeat_period to master failed with error: , Error_code: 1159");
9call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
10call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
11SET @debug_saved=@@global.debug;
12include/stop_slave.inc
13SET @@global.debug="+d,get_master_version.heartbeat.ER_NET_READ_INTERRUPTED";
14START SLAVE;
15include/wait_for_slave_io_to_start.inc
16[log_grep.inc] file: pattern: The slave I/O thread stops because SET @master_heartbeat_period on master failed.
17[log_grep.inc] lines: 0
18include/stop_slave.inc
19SET @@global.debug="+d,get_master_version.serverid.ER_NET_READ_INTERRUPTED";
20START SLAVE;
21include/wait_for_slave_io_to_start.inc
22[log_grep.inc] file: pattern: fatal error is encountered when it try to get the value of SERVER_ID variable from master
23[log_grep.inc] lines: 0
24include/stop_slave.inc
25SET @@global.debug="+d,get_master_version.timestamp.ER_NET_READ_INTERRUPTED";
26START SLAVE;
27include/wait_for_slave_io_to_start.inc
28[log_grep.inc] file: pattern: "SELECT UNIX_TIMESTAMP.." failed on master, do not trust column
29[log_grep.inc] lines: 0
30include/stop_slave.inc
31SET @@global.debug='';
32include/start_slave.inc
33include/rpl_end.inc
034
=== added file 'mysql-test/suite/rpl/t/rpl_percona_gmvac_net_err.test'
--- mysql-test/suite/rpl/t/rpl_percona_gmvac_net_err.test 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/rpl/t/rpl_percona_gmvac_net_err.test 2014-02-27 16:24:37 +0000
@@ -0,0 +1,67 @@
1# Bug #1268735:
2# Slave I/O thread won't attempt to automatically reconnect to the master
3# on ER_NET_READ_INTERRUPTED network error.
4#
5# The bug is in get_master_version_and_clock(). There are two places in this
6# function where the bug takes place. The first one is getting master server id
7# and the second one is getting master time. The error was injected to the code
8# to test the bug fix.
9
10source include/master-slave.inc;
11# The error injection works only with debug facilities.
12source include/have_debug.inc;
13source include/have_debug_sync.inc;
14# The test is not supposed to have any binglog affairs.
15# Hence it's enough it to run only with one binlog format
16source include/have_binlog_format_mixed.inc;
17
18call mtr.add_suppression("Slave I/O: Get master clock failed with error: , Error_code: 1159");
19call mtr.add_suppression("Get master SERVER_ID failed with error: , Error_code: 1159");
20call mtr.add_suppression("Slave I/O: SET @master_heartbeat_period to master failed with error: , Error_code: 1159");
21call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
22call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
23
24let log_file_full_path= `SELECT @@GLOBAL.log_error`;
25if(!$log_file_full_path)
26{
27 # MySQL Server on windows is started with --console and thus
28 # does not know the location of its .err log, use default location
29 let log_file_full_path = $MYSQLTEST_VARDIR/log/mysqld.2.err;
30}
31
32connection slave;
33SET @debug_saved=@@global.debug;
34
35# i=1 for activating injected error during getting timestamp from master
36# i=2 for activating injected error during getting server id from master
37# i=3 for activating injected error during setting @master_heartbeat_period
38let i=3;
39
40connection slave;
41source include/stop_slave.inc;
42let old_debug=`SELECT @@global.debug`;
43
44while($i)
45{
46 let debug_name=`SELECT CASE $i WHEN 1 THEN 'get_master_version.timestamp.ER_NET_READ_INTERRUPTED' WHEN 2 THEN 'get_master_version.serverid.ER_NET_READ_INTERRUPTED' WHEN 3 THEN 'get_master_version.heartbeat.ER_NET_READ_INTERRUPTED' END`;
47
48 # Stop slave and set debug variables
49 eval SET @@global.debug="+d,$debug_name";
50
51 START SLAVE;
52 # Crash if error during slave starting takes place
53 let $rpl_allow_error= 0;
54 source include/wait_for_slave_io_to_start.inc;
55
56 let grep_pattern=`SELECT CASE $i WHEN 1 THEN '"SELECT UNIX_TIMESTAMP.." failed on master, do not trust column' WHEN 2 THEN 'fatal error is encountered when it try to get the value of SERVER_ID variable from master' WHEN 3 THEN 'The slave I/O thread stops because SET @master_heartbeat_period on master failed.' END`;
57
58 source include/log_grep.inc;
59
60 source include/stop_slave.inc;
61 dec $i;
62}
63
64eval SET @@global.debug='$old_debug';
65
66source include/start_slave.inc;
67source include/rpl_end.inc;
068
=== modified file 'sql-common/client.c'
--- sql-common/client.c 2013-12-05 17:23:10 +0000
+++ sql-common/client.c 2014-02-27 16:24:37 +0000
@@ -4153,6 +4153,12 @@
4153 DBUG_ENTER("mysql_real_query");4153 DBUG_ENTER("mysql_real_query");
4154 DBUG_PRINT("enter",("handle: %p", mysql));4154 DBUG_PRINT("enter",("handle: %p", mysql));
4155 DBUG_PRINT("query",("Query = '%-.*s'", (int) length, query));4155 DBUG_PRINT("query",("Query = '%-.*s'", (int) length, query));
4156 DBUG_EXECUTE_IF("inject_ER_NET_READ_INTERRUPTED",
4157 {
4158 mysql->net.last_errno= ER_NET_READ_INTERRUPTED;
4159 DBUG_SET("-d,inject_ER_NET_READ_INTERRUPTED");
4160 DBUG_RETURN(1);
4161 });
41564162
4157 if (mysql_send_query(mysql,query,length))4163 if (mysql_send_query(mysql,query,length))
4158 DBUG_RETURN(1);4164 DBUG_RETURN(1);
41594165
=== modified file 'sql/rpl_slave.cc'
--- sql/rpl_slave.cc 2014-02-17 11:12:40 +0000
+++ sql/rpl_slave.cc 2014-02-27 16:24:37 +0000
@@ -1471,7 +1471,8 @@
1471 errorno == CR_SERVER_GONE_ERROR ||1471 errorno == CR_SERVER_GONE_ERROR ||
1472 errorno == CR_SERVER_LOST ||1472 errorno == CR_SERVER_LOST ||
1473 errorno == ER_CON_COUNT_ERROR ||1473 errorno == ER_CON_COUNT_ERROR ||
1474 errorno == ER_SERVER_SHUTDOWN)1474 errorno == ER_SERVER_SHUTDOWN ||
1475 errorno == ER_NET_READ_INTERRUPTED)
1475 return TRUE;1476 return TRUE;
14761477
1477 return FALSE; 1478 return FALSE;
@@ -1862,6 +1863,12 @@
1862 };);1863 };);
18631864
1864 master_res= NULL;1865 master_res= NULL;
1866 DBUG_EXECUTE_IF("get_master_version.timestamp.ER_NET_READ_INTERRUPTED",
1867 {
1868 DBUG_SET("+d,inject_ER_NET_READ_INTERRUPTED");
1869 DBUG_SET("-d,get_master_version.timestamp."
1870 "ER_NET_READ_INTERRUPTED");
1871 });
1865 if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&1872 if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&
1866 (master_res= mysql_store_result(mysql)) &&1873 (master_res= mysql_store_result(mysql)) &&
1867 (master_row= mysql_fetch_row(master_res)))1874 (master_row= mysql_fetch_row(master_res)))
@@ -1916,6 +1923,12 @@
1916 };);1923 };);
1917 master_res= NULL;1924 master_res= NULL;
1918 master_row= NULL;1925 master_row= NULL;
1926 DBUG_EXECUTE_IF("get_master_version.server_id.ER_NET_READ_INTERRUPTED",
1927 {
1928 DBUG_SET("+d,inject_ER_NET_READ_INTERRUPTED");
1929 DBUG_SET("-d,get_master_version.server_id."
1930 "ER_NET_READ_INTERRUPTED");
1931 });
1919 if (!mysql_real_query(mysql,1932 if (!mysql_real_query(mysql,
1920 STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) &&1933 STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) &&
1921 (master_res= mysql_store_result(mysql)) &&1934 (master_res= mysql_store_result(mysql)) &&
@@ -2105,7 +2118,12 @@
2105 */2118 */
2106 llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);2119 llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
2107 sprintf(query, query_format, llbuf);2120 sprintf(query, query_format, llbuf);
21082121 DBUG_EXECUTE_IF("get_master_version.heartbeat.ER_NET_READ_INTERRUPTED",
2122 {
2123 DBUG_SET("+d,inject_ER_NET_READ_INTERRUPTED");
2124 DBUG_SET("-d,get_master_version.heartbeat."
2125 "ER_NET_READ_INTERRUPTED");
2126 });
2109 if (mysql_real_query(mysql, query, strlen(query)))2127 if (mysql_real_query(mysql, query, strlen(query)))
2110 {2128 {
2111 if (check_io_slave_killed(mi->info_thd, mi, NULL))2129 if (check_io_slave_killed(mi->info_thd, mi, NULL))

Subscribers

People subscribed via source and target branches