summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorNuno Carvalho <nuno.carvalho@oracle.com>2012-01-19 16:56:43 +0000
committerNuno Carvalho <nuno.carvalho@oracle.com>2012-01-19 16:56:43 +0000
commit37fce0ece437daf6035e6f6ecd6ec6342b0d224a (patch)
treedaa67a852e8fbcee19ebf6cad41af4facda78828 /mysql-test
parentefddb7acb937380acfe667b460555687df728878 (diff)
downloadmariadb-git-37fce0ece437daf6035e6f6ecd6ec6342b0d224a.tar.gz
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.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_start_stop_slave.test2
-rw-r--r--mysql-test/include/show_slave_status.inc28
-rw-r--r--mysql-test/include/wait_for_slave_io_error.inc1
-rw-r--r--mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_manual_change_index_file.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_manual_change_index_file.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test4
12 files changed, 40 insertions, 20 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
index 301f4d84c58..5aa1d75c516 100644
--- a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
@@ -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
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index e2fdc72b18b..52ec550ce60 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/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
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index bc78c9e2da1..4177bf4b858 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -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
}
diff --git a/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result b/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
index a719f865090..a406a6afe92 100644
--- a/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
@@ -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;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index afd91a29f9e..49691bea9b6 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -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
diff --git a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
index efe9bf076f0..2143b3492d5 100644
--- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
+++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
@@ -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);
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
index b2da820755e..7591006abcb 100644
--- a/mysql-test/suite/rpl/r/rpl_packet.result
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -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;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
index 8bf903b0713..a7f3744b582 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
@@ -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;
diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
index 490ddf5d167..27478a318b8 100644
--- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
@@ -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
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
index a6521113b37..1043a80b5d5 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -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;
diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
index 8914b215632..981cecb66ad 100644
--- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
+++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
@@ -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;
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index 06a03131a57..4f296fed68e 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -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.