1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
call mtr.add_suppression("An error occurred during flush stage of the commit");
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out*");
call mtr.add_suppression(".*Error writing file.*");
RESET MASTER;
CREATE TABLE t1(c1 varchar(8192));
CREATE TABLE t2(c1 varchar(8192));
CREATE TABLE t3(c1 varchar(8192));
SET GLOBAL binlog_cache_size = 4096;
# Case 1 Simulate my_b_flush_io_cache failure when truncating binlog
# cache. ROLLBACK TO triggers binlog cache truncation process.
include/save_binlog_position.inc
BEGIN;
INSERT INTO t1 VALUES (repeat('a', 2048));
SAVEPOINT sp1;
INSERT INTO t2 VALUES (repeat('a', 4096));
INSERT INTO t3 VALUES (repeat('b', 4096));
SET SESSION debug = "+d,simulate_error_during_flush_cache_to_file";
ROLLBACK TO sp1;
SET SESSION debug = "-d,simulate_error_during_flush_cache_to_file";
INSERT INTO t1 VALUES (repeat('c', 8192));
COMMIT;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # SAVEPOINT `sp1`
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Xid # # COMMIT /* XID */
# Case 2 Simulate my_b_flush_io_cache failure when reseting binlog cache
# in ROLLBACK statement
BEGIN;
INSERT INTO t1 VALUES (repeat('a', 8192));
SET SESSION debug = "+d,simulate_error_during_flush_cache_to_file";
ROLLBACK;
SET SESSION debug = "-d,simulate_error_during_flush_cache_to_file";
# Case 3 CLIENT DISCONNECT. it is same to ROLLBACK
BEGIN;
INSERT INTO t1 VALUES (repeat('a', 8192));
SET SESSION debug = "+d,simulate_error_during_flush_cache_to_file";
# Case 4 Simulate write failure when reinitializing binlog cache for
# copying to binlog. The error should be ignored and cache
# is cleared correctly if binlog_error_action is IGNORE_ERROR
#
TRUNCATE t1;
include/save_binlog_position.inc
SET GLOBAL binlog_error_action = IGNORE_ERROR;
BEGIN;
INSERT INTO t1 VALUES (repeat('a', 8192));
SET SESSION debug = "+d,fault_injection_reinit_io_cache_while_flushing_to_file";
COMMIT;
Warnings:
Error 1026 Error writing file <tmp_file_name> (Errcode: ##)
SET SESSION debug = "-d,fault_injection_reinit_io_cache_while_flushing_to_file";
include/assert_grep.inc [An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'IGNORE_ERROR'.]
# restart
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Stop # #
# Case 5 Simulate write failure when reinitializing binlog cache for
# copying to binlog with ABORT_SERVER
#
SET GLOBAL binlog_cache_size = 4096;
select @@global.binlog_cache_size;
@@global.binlog_cache_size
4096
TRUNCATE t2;
include/save_binlog_position.inc
SET GLOBAL binlog_error_action = ABORT_SERVER;
BEGIN;
INSERT INTO t2 VALUES (repeat('b', 8192));
SET SESSION debug = "+d,fault_injection_reinit_io_cache_while_flushing_to_file";
COMMIT;
ERROR HY000: Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Server is being stopped.
# restart
select * from t2;
c1
include/assert.inc [Count of elements in t2 should be 0.]
include/show_binlog_events.inc
DROP TABLE t1, t2, t3;
RESET MASTER;
|