Skip to content

Commit

Permalink
WL#8314: Make binlog_error_action=ABORT_SERVER the default in 5.7
Browse files Browse the repository at this point in the history
RB: 8150
  • Loading branch information
Narendra Chauhan committed Feb 25, 2015
1 parent 9a7a88c commit 9a05c98
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ bind-address *
binlog-cache-size 32768
binlog-checksum CRC32
binlog-direct-non-transactional-updates FALSE
binlog-error-action IGNORE_ERROR
binlog-error-action ABORT_SERVER
binlog-format STATEMENT
binlog-group-commit-sync-delay 0
binlog-group-commit-sync-no-delay-count 0
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/mysqld--help-win.result
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ bind-address *
binlog-cache-size 32768
binlog-checksum CRC32
binlog-direct-non-transactional-updates FALSE
binlog-error-action IGNORE_ERROR
binlog-error-action ABORT_SERVER
binlog-format STATEMENT
binlog-group-commit-sync-delay 0
binlog-group-commit-sync-no-delay-count 0
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/suite/binlog/r/binlog_error_action.result
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SET GLOBAL binlog_error_action= ABORT_SERVER;
flush logs;
ERROR HY000: Binary logging not possible. Message: Either disk is full or file system is read only while opening the binlog. Aborting the server
Test case5
SET GLOBAL binlog_error_action= IGNORE_ERROR;
flush logs;
ERROR HY000: File 'master-bin.index' not found (Errcode: 13 - Permission denied)
CREATE TABLE t1 ( f int );
Expand All @@ -37,6 +38,7 @@ DROP TABLE t1;
# restart
Test case6
SET SESSION debug="+d,fault_injection_updating_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
flush logs;
ERROR HY000: Can't open file: 'master-bin.000007' (errno: 1 - Operation not permitted)
CREATE TABLE t2 (f int );
Expand All @@ -47,12 +49,14 @@ DROP TABLE t2;
SET SESSION debug="-d,fault_injection_updating_index";
# restart
Test case7
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET SESSION debug="+d,simulate_disk_full_on_open_binlog";
flush logs;
ERROR HY000: Error writing file 'master-bin.index_crash_safe' (Errcode: 28 - No space left on device)
SET SESSION debug="-d,simulate_disk_full_on_open_binlog";
# restart
Test case8
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET SESSION debug="+d,fault_injection_init_name";
flush logs;
ERROR HY000: Can't open file: 'master-bin.000009' (errno: 1 - Operation not permitted)
Expand All @@ -64,3 +68,4 @@ DROP TABLE t2;
SET SESSION debug="-d,fault_injection_init_name";
# restart
SET SESSION debug="";
SET GLOBAL binlog_error_action= ABORT_SERVER;
2 changes: 2 additions & 0 deletions mysql-test/suite/binlog/r/binlog_gtids_table_gcov.result
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SELECT * FROM mysql.gtid_executed;
source_uuid interval_start interval_end
MASTER_UUID 1 2
SET GLOBAL DEBUG= @debug_save;
SET GLOBAL binlog_error_action= IGNORE_ERROR;
call mtr.add_suppression(".* Turning logging off for the whole duration of the "
"MySQL server process. To turn it on again: fix the "
"cause, shutdown the MySQL server and restart it.");
Expand All @@ -34,6 +35,7 @@ SELECT * FROM mysql.gtid_executed;
source_uuid interval_start interval_end
MASTER_UUID 1 2
include/assert.inc [committed gtid set is MASTER_UUID:1-4]
SET GLOBAL binlog_error_action= ABORT_SERVER;
DROP TABLE t1;
# restart
RESET MASTER;
3 changes: 3 additions & 0 deletions mysql-test/suite/binlog/r/binlog_index.result
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ master-bin.000011

# fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
flush logs;
ERROR HY000: Can't open file: 'master-bin.000012' (errno: 1 - Operation not permitted)
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
Expand All @@ -161,6 +162,7 @@ master-bin.000012

# fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
flush logs;
ERROR HY000: Can't open file: 'master-bin.000013' (errno: 1 - Operation not permitted)
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
Expand Down Expand Up @@ -330,4 +332,5 @@ master-bin.000018 #
master-bin.000019 #
master-bin.000020 #
SET SESSION debug="";
SET GLOBAL binlog_error_action= ABORT_SERVER;
End of tests
7 changes: 7 additions & 0 deletions mysql-test/suite/binlog/t/binlog_error_action.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ call mtr.add_suppression("The server was unable to create a new log file *");

let $old=`select @@debug`;

--let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`

RESET MASTER;

--echo Test case1
Expand Down Expand Up @@ -89,6 +91,7 @@ flush logs;

--echo Test case5
# Make binlog index readonly and check the behaviour with IGNORE
SET GLOBAL binlog_error_action= IGNORE_ERROR;
--chmod 0444 $INDEX
--replace_regex /\.[\\\/]master/master/ /errno: 13 - .*\)/errno: 13 - Permission denied)/
--error 29
Expand All @@ -103,6 +106,7 @@ DROP TABLE t1;
# Make MYSQL_BIN_LOG::open_binlog fail with debug simulation and test
# the behaviour in case of IGNORE
SET SESSION debug="+d,fault_injection_updating_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
--replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
--error ER_CANT_OPEN_FILE
flush logs;
Expand All @@ -116,6 +120,7 @@ SET SESSION debug="-d,fault_injection_updating_index";
# Simulate diskfull during opening of binlog and check for diskfull error
# behaviour where binlogging impossible error is to continue the server
# after the error.
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET SESSION debug="+d,simulate_disk_full_on_open_binlog";
--replace_regex /\.[\\\/]master/master/ /Errcode: 28 - .*\)/Errcode: 28 - No space left on device)/
# error EE_WRITE with error code number 3 is expected.
Expand All @@ -125,6 +130,7 @@ SET SESSION debug="-d,simulate_disk_full_on_open_binlog";
--source include/restart_mysqld.inc

--echo Test case8
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET SESSION debug="+d,fault_injection_init_name";
--replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
--error ER_CANT_OPEN_FILE
Expand All @@ -137,3 +143,4 @@ SET SESSION debug="-d,fault_injection_init_name";

# Cleanup
eval SET SESSION debug="$old";
--eval SET GLOBAL binlog_error_action= $saved_binlog_error_action
3 changes: 3 additions & 0 deletions mysql-test/suite/binlog/t/binlog_gtids_table_gcov.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ call mtr.add_suppression("Failed to save the set of Global Transaction "
"another attempt to save Global Transaction "
"Identifiers into the table.");
SET @debug_save= @@GLOBAL.DEBUG;
--let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
CREATE TABLE t1 (a INT) ENGINE=InnoDB;

Expand All @@ -43,6 +44,7 @@ SET @@GLOBAL.DEBUG= "+d,simulate_err_on_write_gtid_into_table";
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;
SET GLOBAL DEBUG= @debug_save;
SET GLOBAL binlog_error_action= IGNORE_ERROR;

call mtr.add_suppression(".* Turning logging off for the whole duration of the "
"MySQL server process. To turn it on again: fix the "
Expand All @@ -61,6 +63,7 @@ SELECT * FROM mysql.gtid_executed;
--let $assert_text= committed gtid set is MASTER_UUID:1-4
--let $assert_cond= @@GLOBAL.GTID_EXECUTED = "$master_uuid:1-4"
--source include/assert.inc
--eval SET GLOBAL binlog_error_action= $saved_binlog_error_action

DROP TABLE t1;

Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/binlog/t/binlog_index.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ call mtr.add_suppression("The server was unable to create a new log file. "
"An incident event has been written to the binary "
"log which will stop the slaves.");
let $old=`select @@debug`;
let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`;

RESET MASTER;

Expand Down Expand Up @@ -224,6 +225,7 @@ SELECT @index;

--echo # fault_injection_registering_index
SET SESSION debug="+d,fault_injection_registering_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
-- error ER_CANT_OPEN_FILE
Expand All @@ -245,6 +247,7 @@ SELECT @index;

--echo # fault_injection_updating_index
SET SESSION debug="+d,fault_injection_updating_index";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
-- error ER_CANT_OPEN_FILE
Expand Down Expand Up @@ -422,5 +425,6 @@ file_exists $MYSQLD_DATADIR/master-bin.000013;
file_exists $MYSQLD_DATADIR/master-bin.000014;

eval SET SESSION debug="$old";
eval SET GLOBAL binlog_error_action= $saved_binlog_error_action;

--echo End of tests
4 changes: 4 additions & 0 deletions mysql-test/suite/rpl/r/rpl_binlog_errors.result
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ call mtr.add_suppression("Could not open .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET @old_debug=@@global.debug;
include/stop_slave.inc
SET GLOBAL debug="+d,error_unique_log_filename";
Expand All @@ -234,6 +235,7 @@ SET GLOBAL debug="-d,error_unique_log_filename";
SET GLOBAL debug=@old_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #14
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET @old_debug=@@global.debug;
include/stop_slave.inc
SET GLOBAL debug="+d,fault_injection_new_file_rotate_event";
Expand All @@ -244,6 +246,7 @@ SET GLOBAL debug="-d,fault_injection_new_file_rotate_event";
SET GLOBAL debug=@old_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #15
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET @old_debug=@@global.debug;
include/stop_slave.inc
SET GLOBAL debug="+d,fault_injection_registering_index";
Expand All @@ -254,6 +257,7 @@ SET GLOBAL debug="-d,fault_injection_registering_index";
SET GLOBAL debug=@old_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #16
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET @old_debug=@@global.debug;
include/stop_slave.inc
SET GLOBAL debug="+d,fault_injection_openning_index";
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/suite/rpl/r/rpl_gtid_mode.result
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,12 @@ include/sync_slave_sql_with_master.inc
include/stop_slave.inc
SET @debug_saved= @@GLOBAL.DEBUG;
SET GLOBAL DEBUG= "d,fault_injection_new_file_rotate_event";
SET GLOBAL binlog_error_action= IGNORE_ERROR;
SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;
ERROR HY000: Can't open file: 'slave-bin' (errno: 2 - No such file or directory)
SET @@GLOBAL.GTID_MODE= OFF;
SET @@GLOBAL.DEBUG= @debug_saved;
SET GLOBAL binlog_error_action= ABORT_SERVER;
include/rpl_restart_server.inc [server_number=1 gtids=off]
[connection master]
SET GLOBAL ENFORCE_GTID_CONSISTENCY = ON;
Expand Down
10 changes: 10 additions & 0 deletions mysql-test/suite/rpl/t/rpl_binlog_errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ call mtr.add_suppression("The server was unable to create a new log file. "
--enable_query_log

--let $old_debug = `select @@global.debug`
--let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`

### ACTION: create a large file (> 4096 bytes) that will be later used
### in LOAD DATA INFILE to check binlog errors in its vacinity
Expand Down Expand Up @@ -334,6 +335,7 @@ SHOW WARNINGS;
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK
--disable_query_log
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_registering_index"), 'd,fault_injection_registering_index');
SET GLOBAL binlog_error_action= IGNORE_ERROR;
--enable_query_log
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
-- error ER_CANT_OPEN_FILE
Expand Down Expand Up @@ -366,6 +368,7 @@ DROP TABLE t5;
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
--disable_query_log
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_openning_index"), 'd,fault_injection_openning_index');
SET GLOBAL binlog_error_action= IGNORE_ERROR;
--enable_query_log
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/
Expand Down Expand Up @@ -399,6 +402,7 @@ DROP TABLE t5;
# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
--disable_query_log
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_new_file_rotate_event"), 'd,fault_injection_new_file_rotate_event');
SET GLOBAL binlog_error_action= IGNORE_ERROR;
--enable_query_log
-- error ER_ERROR_ON_WRITE
FLUSH LOGS;
Expand All @@ -423,6 +427,7 @@ DROP TABLE t5;
## clean up
--disable_query_log
eval SET GLOBAL debug= '$old_debug';
--eval SET GLOBAL binlog_error_action= $saved_binlog_error_action
--enable_query_log
DROP TABLE t1, t2, t4;
RESET MASTER;
Expand All @@ -448,6 +453,7 @@ call mtr.add_suppression("Could not open .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
-- echo ###################### TEST #13
SET GLOBAL binlog_error_action= IGNORE_ERROR;

#### ASSERTION: check against unique log filename error
-- let $io_thd_injection_fault_flag= error_unique_log_filename
Expand All @@ -456,6 +462,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*");
-- source include/io_thd_fault_injection.inc

-- echo ###################### TEST #14
SET GLOBAL binlog_error_action= IGNORE_ERROR;

#### ASSERTION: check against rotate failing
-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event
Expand All @@ -464,6 +471,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*");
-- source include/io_thd_fault_injection.inc

-- echo ###################### TEST #15
SET GLOBAL binlog_error_action= IGNORE_ERROR;

#### ASSERTION: check against relay log open failure
-- let $io_thd_injection_fault_flag= fault_injection_registering_index
Expand All @@ -472,6 +480,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*");
-- source include/io_thd_fault_injection.inc

-- echo ###################### TEST #16
SET GLOBAL binlog_error_action= IGNORE_ERROR;

#### ASSERTION: check against relay log index open failure
-- let $io_thd_injection_fault_flag= fault_injection_openning_index
Expand All @@ -483,6 +492,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*");
-- source include/stop_slave_sql.inc
--disable_query_log
eval SET GLOBAL debug='$old_debug';
--eval SET GLOBAL binlog_error_action= $saved_binlog_error_action
--enable_query_log
RESET SLAVE;
RESET MASTER;
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/rpl/t/rpl_gtid_mode.test
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

call mtr.add_suppression("Slave I/O for channel '': The replication receiver thread cannot start");
call mtr.add_suppression("Slave I/O for channel '': The slave IO thread stops");
--let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`

--source include/sync_slave_sql_with_master.inc
--source include/stop_slave.inc
Expand Down Expand Up @@ -566,12 +567,15 @@ call mtr.add_suppression("Could not open * for logging");
SET @debug_saved= @@GLOBAL.DEBUG;
SET GLOBAL DEBUG= "d,fault_injection_new_file_rotate_event";

SET GLOBAL binlog_error_action= IGNORE_ERROR;

--error ER_ERROR_ON_WRITE
SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;

# Cleanup
SET @@GLOBAL.GTID_MODE= OFF;
SET @@GLOBAL.DEBUG= @debug_saved;
--eval SET GLOBAL binlog_error_action= $saved_binlog_error_action

# Binlog was closed as a result of the error, restart server to recover.
--let $rpl_server_number= 1
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/sys_vars/r/binlog_error_action_basic.result
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
SELECT @@GLOBAL.binlog_error_action;
@@GLOBAL.binlog_error_action
IGNORE_ERROR
IGNORE_ERROR Expected
ABORT_SERVER
ABORT_SERVER Expected
SELECT @@SESSION.binlog_error_action;
ERROR HY000: Variable 'binlog_error_action' is a GLOBAL variable
SET @start_value= @@global.binlog_error_action;
SHOW GLOBAL VARIABLES LIKE 'binlog_error_action';
Variable_name Value
binlog_error_action IGNORE_ERROR
binlog_error_action ABORT_SERVER
SET @@GLOBAL.binlog_error_action=IGNORE_ERROR;
SELECT @@GLOBAL.binlog_error_action;
@@GLOBAL.binlog_error_action
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/sys_vars/t/binlog_error_action_basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


SELECT @@GLOBAL.binlog_error_action;
--echo IGNORE_ERROR Expected
--echo ABORT_SERVER Expected

--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@SESSION.binlog_error_action;
Expand Down
2 changes: 1 addition & 1 deletion sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ static Sys_var_enum Sys_binlog_error_action(
"When statements cannot be written to the binary log due to a fatal "
"error, the server can either ignore the error and let the master "
"continue, or abort.", GLOBAL_VAR(binlog_error_action),
CMD_LINE(REQUIRED_ARG), binlog_error_action_list, DEFAULT(IGNORE_ERROR));
CMD_LINE(REQUIRED_ARG), binlog_error_action_list, DEFAULT(ABORT_SERVER));

static Sys_var_mybool Sys_trust_function_creators(
"log_bin_trust_function_creators",
Expand Down

0 comments on commit 9a05c98

Please sign in to comment.