Commit 9e161d30 authored by Luis Soares's avatar Luis Soares

BUG#46166

Post-push fixes:

  - fixed platform dependent result files
  - appeasing valgrind warnings:
   
    Fault injection was also uncovering a previously existing 
    potential mem leaks. For BUG#46166 testing purposes, fixed 
    by forcing handling the leak when injecting faults.
parent 60f65006
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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";
......
......@@ -2599,6 +2599,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);
}
......@@ -3827,6 +3844,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;
......
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