Commit e1a89da5 authored by Nuno Carvalho's avatar Nuno Carvalho

BUG#13050593 - BACKSLASH SWALLOWED BY INCLUDE/SHOW_SLAVE_STATUS.INC

If an error message contains '\' backslash it is displayed correctly
through show-slave-status or
query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);. But when
SELECT REPLACE(...) is applied backslash is escaped resulting in a
different test output.

Disabled backslash escape on show_slave_status.inc and replaced '\' for
'/' using replace_regex function in order to achieve the same test
output when different path separators are used.
parent 65bb9e4f
......@@ -199,7 +199,7 @@ START SLAVE;
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
......
......@@ -56,10 +56,17 @@
#
# --let $status_items= Master_Log_File, Relay_Master_Log_File
#
# $slave_io_error_replace
# $slave_field_result_replace
# If set, one or more regex patterns for replacing variable
# text in the error message. Syntax as --replace-regex
#
# $slave_sql_mode
# If set, change the slave sql mode during this macro, reverting
# to the previous on exit. Default sql_mode is NO_BACKSLASH_ESCAPES
# to allow replace '\' by '/' making paths OS independent. Example:
#
# --let $slave_sql_mode= NO_BACKSLASH_ESCAPES
#
--let $_show_slave_status_items=$status_items
......@@ -69,13 +76,30 @@ if (!$status_items)
}
--let $_slave_sql_mode= NO_BACKSLASH_ESCAPES
if ($slave_sql_mode)
{
--let $_slave_sql_mode= $slave_sql_mode
}
--let $_previous_slave_sql_mode = `SELECT @@sql_mode`
--disable_query_log
eval SET sql_mode= '$_slave_sql_mode';
--enable_query_log
while ($_show_slave_status_items)
{
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
--let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
--replace_regex $slave_io_error_replace
--let $_slave_field_result_replace= /[\\]/\// $slave_field_result_replace
--replace_regex $_slave_field_result_replace
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
--echo $_show_slave_status_name = '$_show_slave_status_value'
}
--disable_query_log
eval SET sql_mode= '$_previous_slave_sql_mode';
--enable_query_log
......@@ -76,6 +76,7 @@ if ($show_slave_io_error)
{
--let $_wait_for_slave_io_error_old_status_items= $status_items
--let $status_items= Last_IO_Error
--let $slave_field_result_replace= $slave_io_error_replace
--source include/show_slave_status.inc
--let $status_items= $_wait_for_slave_io_error_old_status_items
}
......
......@@ -11,7 +11,7 @@ reset slave;
start slave;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the start event position from '' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the start event position from '' at XXX, the last event was read from './master-bin.000001' at XXX, the last byte read was read from './master-bin.000001' at XXX.''
reset master;
stop slave;
reset slave;
......
......@@ -9,7 +9,7 @@ change master to master_log_pos=MASTER_LOG_POS;
Read_Master_Log_Pos = '75'
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from 'master-bin.000001' at XXX, the last event was read from './master-bin.000001' at XXX, the last byte read was read from './master-bin.000001' at XXX.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
......
......@@ -5,7 +5,7 @@ CREATE TABLE t1(c1 INT);
FLUSH LOGS;
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the start event position from 'master-bin.000001' at XXX, the last event was read from './master-bin.000002' at XXX, the last byte read was read from './master-bin.000002' at XXX.''
CREATE TABLE t2(c1 INT);
FLUSH LOGS;
CREATE TABLE t3(c1 INT);
......
......@@ -37,7 +37,7 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from '' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from '' at XXX, the last event was read from './master-bin.000001' at XXX, the last byte read was read from './master-bin.000001' at XXX.''
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
......
......@@ -75,7 +75,7 @@ CHANGE MASTER TO master_log_pos=MASTER_POS;
START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the start event position from 'master-bin.000001' at XXX, the last event was read from './master-bin.000001' at XXX, the last byte read was read from './master-bin.000001' at XXX.''
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
......
......@@ -14,11 +14,6 @@
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
#
# Bug#13050593 swallows `\' from Last_IO_Error
# todo: uncomment the filter once the bug is fixed.
#
--source include/not_windows.inc
call mtr.add_suppression("Error in Log_event::read_log_event()");
......@@ -51,7 +46,7 @@ start slave;
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
......
......@@ -23,8 +23,8 @@ source include/show_slave_status.inc;
start slave;
let $slave_io_errno= 1236;
--let $show_slave_io_error= 1
# Mask line numbers, and whether master-bin is preceded by "./" or "."
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
source include/wait_for_slave_io_error.inc;
source include/stop_slave_sql.inc;
......
......@@ -61,8 +61,8 @@ connection slave;
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
--let $slave_io_errno= 1236
--let $show_slave_io_error= 1
# Mask line numbers, and whether master-bin is preceded by "./" or "."
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--source include/wait_for_slave_io_error.inc
connection master;
......
......@@ -126,8 +126,8 @@ connection slave;
# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
--let $slave_io_errno= 1236
# Mask line numbers, and whether master-bin is preceded by "./" or "."
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--source include/wait_for_slave_io_error.inc
# Remove the bad binlog and clear error status on slave.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment