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