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 ...@@ -132,7 +132,7 @@ master-bin.000011
# fault_injection_registering_index # fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index"; SET SESSION debug="+d,fault_injection_registering_index";
flush logs; 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'); SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index; SELECT @index;
@index @index
...@@ -157,7 +157,7 @@ master-bin.000012 ...@@ -157,7 +157,7 @@ master-bin.000012
# fault_injection_updating_index # fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index"; SET SESSION debug="+d,fault_injection_updating_index";
flush logs; 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'); SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index; SELECT @index;
@index @index
......
...@@ -218,6 +218,7 @@ SELECT @index; ...@@ -218,6 +218,7 @@ SELECT @index;
--echo # fault_injection_registering_index --echo # fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index"; SET SESSION debug="+d,fault_injection_registering_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
flush logs; flush logs;
...@@ -237,6 +238,7 @@ SELECT @index; ...@@ -237,6 +238,7 @@ SELECT @index;
--echo # fault_injection_updating_index --echo # fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index"; SET SESSION debug="+d,fault_injection_updating_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
flush logs; flush logs;
......
...@@ -35,9 +35,9 @@ master-bin.000001 # ...@@ -35,9 +35,9 @@ master-bin.000001 #
SET GLOBAL debug=""; SET GLOBAL debug="";
RESET MASTER; RESET MASTER;
###################### TEST #3 ###################### TEST #3
CREATE TABLE t1 (a int); CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a TEXT) Engine=InnoDB; CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
CREATE TABLE t4 (a TEXT); CREATE TABLE t4 (a VARCHAR(16384));
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
RESET MASTER; RESET MASTER;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
...@@ -181,7 +181,7 @@ SHOW WARNINGS; ...@@ -181,7 +181,7 @@ SHOW WARNINGS;
Level Code Message Level Code Message
SET GLOBAL debug="+d,fault_injection_registering_index"; SET GLOBAL debug="+d,fault_injection_registering_index";
FLUSH LOGS; 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"; SET GLOBAL debug="-d,fault_injection_registering_index";
SHOW BINARY LOGS; SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging ERROR HY000: You are not using binary logging
...@@ -194,7 +194,7 @@ DROP TABLE t5; ...@@ -194,7 +194,7 @@ DROP TABLE t5;
###################### TEST #11 ###################### TEST #11
SET GLOBAL debug="+d,fault_injection_openning_index"; SET GLOBAL debug="+d,fault_injection_openning_index";
FLUSH LOGS; 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"; SET GLOBAL debug="-d,fault_injection_openning_index";
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
...@@ -207,7 +207,7 @@ DROP TABLE t5; ...@@ -207,7 +207,7 @@ DROP TABLE t5;
###################### TEST #12 ###################### TEST #12
SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; SET GLOBAL debug="+d,fault_injection_new_file_rotate_event";
FLUSH LOGS; 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"; SET GLOBAL debug="-d,fault_injection_new_file_rotate_event";
RESET MASTER; RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER ERROR HY000: Binlog closed, cannot RESET MASTER
......
...@@ -82,9 +82,9 @@ RESET MASTER; ...@@ -82,9 +82,9 @@ RESET MASTER;
### ACTION: create some tables (t1, t2, t4) and insert some values in ### ACTION: create some tables (t1, t2, t4) and insert some values in
### table t1 ### table t1
CREATE TABLE t1 (a int); CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a TEXT) Engine=InnoDB; CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
CREATE TABLE t4 (a TEXT); CREATE TABLE t4 (a VARCHAR(16384));
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
RESET MASTER; RESET MASTER;
...@@ -272,6 +272,7 @@ SHOW WARNINGS; ...@@ -272,6 +272,7 @@ SHOW WARNINGS;
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open # +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
SET GLOBAL debug="+d,fault_injection_registering_index"; SET GLOBAL debug="+d,fault_injection_registering_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
FLUSH LOGS; FLUSH LOGS;
SET GLOBAL debug="-d,fault_injection_registering_index"; SET GLOBAL debug="-d,fault_injection_registering_index";
...@@ -298,6 +299,7 @@ DROP TABLE t5; ...@@ -298,6 +299,7 @@ DROP TABLE t5;
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file # +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
SET GLOBAL debug="+d,fault_injection_openning_index"; SET GLOBAL debug="+d,fault_injection_openning_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE -- error ER_CANT_OPEN_FILE
FLUSH LOGS; FLUSH LOGS;
SET GLOBAL debug="-d,fault_injection_openning_index"; SET GLOBAL debug="-d,fault_injection_openning_index";
......
...@@ -2599,6 +2599,23 @@ bool MYSQL_BIN_LOG::open(const char *log_name, ...@@ -2599,6 +2599,23 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
sync_purge_index_file() || sync_purge_index_file() ||
DBUG_EVALUATE_IF("fault_injection_registering_index", 1, 0)) 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."); sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file.");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -3827,6 +3844,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock) ...@@ -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) || if(DBUG_EVALUATE_IF("fault_injection_new_file_rotate_event", (error=close_on_error=TRUE), FALSE) ||
(error= r.write(&log_file))) (error= r.write(&log_file)))
{ {
DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno=2;);
close_on_error= TRUE; close_on_error= TRUE;
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_CANT_OPEN_FILE), MYF(ME_FATALERROR), name, errno); my_printf_error(ER_ERROR_ON_WRITE, ER(ER_CANT_OPEN_FILE), MYF(ME_FATALERROR), name, errno);
goto end; 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