summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/binlog/r/binlog_index.result4
-rw-r--r--mysql-test/suite/binlog/t/binlog_index.test2
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_errors.result12
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_errors.test8
-rw-r--r--sql/log.cc18
5 files changed, 33 insertions, 11 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result
index 6b422b82191..11cf43b8a5e 100644
--- a/mysql-test/suite/binlog/r/binlog_index.result
+++ b/mysql-test/suite/binlog/r/binlog_index.result
@@ -132,7 +132,7 @@ master-bin.000011
# fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
flush logs;
-ERROR HY000: Can't open file: './master-bin.000012' (errno: 1)
+ERROR HY000: Can't open file: 'master-bin.000012' (errno: 1)
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
@@ -157,7 +157,7 @@ master-bin.000012
# fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
flush logs;
-ERROR HY000: Can't open file: './master-bin.000013' (errno: 1)
+ERROR HY000: Can't open file: 'master-bin.000013' (errno: 1)
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test
index d2b34083182..b735574fdb9 100644
--- a/mysql-test/suite/binlog/t/binlog_index.test
+++ b/mysql-test/suite/binlog/t/binlog_index.test
@@ -218,6 +218,7 @@ SELECT @index;
--echo # fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
+-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
flush logs;
@@ -237,6 +238,7 @@ SELECT @index;
--echo # fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
+-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
flush logs;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
index e67b60860ca..6c8c750bc79 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
@@ -35,9 +35,9 @@ master-bin.000001 #
SET GLOBAL debug="";
RESET MASTER;
###################### TEST #3
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a TEXT) Engine=InnoDB;
-CREATE TABLE t4 (a TEXT);
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
+CREATE TABLE t4 (a VARCHAR(16384));
INSERT INTO t1 VALUES (1);
RESET MASTER;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@@ -181,7 +181,7 @@ SHOW WARNINGS;
Level Code Message
SET GLOBAL debug="+d,fault_injection_registering_index";
FLUSH LOGS;
-ERROR HY000: Can't open file: './master-bin.000002' (errno: 1)
+ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1)
SET GLOBAL debug="-d,fault_injection_registering_index";
SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging
@@ -194,7 +194,7 @@ DROP TABLE t5;
###################### TEST #11
SET GLOBAL debug="+d,fault_injection_openning_index";
FLUSH LOGS;
-ERROR HY000: Can't open file: './master-bin.index' (errno: 1)
+ERROR HY000: Can't open file: 'master-bin.index' (errno: 1)
SET GLOBAL debug="-d,fault_injection_openning_index";
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
@@ -207,7 +207,7 @@ DROP TABLE t5;
###################### TEST #12
SET GLOBAL debug="+d,fault_injection_new_file_rotate_event";
FLUSH LOGS;
-ERROR HY000: Can't open file: 'master-bin' (errno: 0)
+ERROR HY000: Can't open file: 'master-bin' (errno: 2)
SET GLOBAL debug="-d,fault_injection_new_file_rotate_event";
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
index ae83659a38a..e4eb212e1cd 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
@@ -82,9 +82,9 @@ RESET MASTER;
### ACTION: create some tables (t1, t2, t4) and insert some values in
### table t1
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a TEXT) Engine=InnoDB;
-CREATE TABLE t4 (a TEXT);
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
+CREATE TABLE t4 (a VARCHAR(16384));
INSERT INTO t1 VALUES (1);
RESET MASTER;
@@ -272,6 +272,7 @@ SHOW WARNINGS;
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
SET GLOBAL debug="+d,fault_injection_registering_index";
+-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
FLUSH LOGS;
SET GLOBAL debug="-d,fault_injection_registering_index";
@@ -298,6 +299,7 @@ DROP TABLE t5;
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
SET GLOBAL debug="+d,fault_injection_openning_index";
+-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
FLUSH LOGS;
SET GLOBAL debug="-d,fault_injection_openning_index";
diff --git a/sql/log.cc b/sql/log.cc
index e6f476fd8a1..b9be66f8ce7 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2976,6 +2976,23 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
sync_purge_index_file() ||
DBUG_EVALUATE_IF("fault_injection_registering_index", 1, 0))
{
+ /**
+ TODO: although this was introduced to appease valgrind
+ when injecting emulated faults using fault_injection_registering_index
+ it may be good to consider what actually happens when
+ open_purge_index_file succeeds but register or sync fails.
+
+ Perhaps we might need the code below in MYSQL_LOG_BIN::cleanup
+ for "real life" purposes as well?
+ */
+ DBUG_EXECUTE_IF("fault_injection_registering_index", {
+ if (my_b_inited(&purge_index_file))
+ {
+ end_io_cache(&purge_index_file);
+ my_close(purge_index_file.file, MYF(0));
+ }
+ });
+
sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file.");
DBUG_RETURN(1);
}
@@ -4219,6 +4236,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
if(DBUG_EVALUATE_IF("fault_injection_new_file_rotate_event", (error=close_on_error=TRUE), FALSE) ||
(error= r.write(&log_file)))
{
+ DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno=2;);
close_on_error= TRUE;
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_CANT_OPEN_FILE), MYF(ME_FATALERROR), name, errno);
goto end;