|
1 | 1 | call mtr.add_suppression("An error occurred during flush stage of the commit");
|
2 | 2 | call mtr.add_suppression("Attempting backtrace. You can use the following information to find out*");
|
| 3 | +call mtr.add_suppression(".*Error writing file.*"); |
3 | 4 | RESET MASTER;
|
4 |
| -CREATE TABLE t1(i INT); |
| 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; |
5 | 9 |
|
6 |
| -# Case 1 (binlog_error_action = ABORT_SERVER) |
7 |
| - |
8 |
| -SET GLOBAL binlog_error_action = ABORT_SERVER; |
9 |
| - |
10 |
| -# Case 1.1 CLIENT DISCONNECTION |
| 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 |
11 | 13 | BEGIN;
|
12 |
| -INSERT INTO t1 VALUES (1); |
13 |
| -SET SESSION debug= "+d,simulate_tmpdir_partition_full"; |
14 |
| -INSERT INTO t1 VALUES (2); |
15 |
| -INSERT INTO t1 VALUES (3); |
16 |
| -ERROR HY000: Error writing file <tmp_file_name> (Errcode: ##) |
17 |
| -SET SESSION debug= "-d,simulate_tmpdir_partition_full"; |
| 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 */ |
18 | 32 |
|
19 |
| -# Case 1.2 ROLLBACK |
| 33 | +# Case 2 Simulate my_b_flush_io_cache failure when reseting binlog cache |
| 34 | +# in ROLLBACK statement |
20 | 35 | BEGIN;
|
21 |
| -INSERT INTO t1 VALUES (1); |
22 |
| -SET SESSION debug= "+d,simulate_tmpdir_partition_full"; |
23 |
| -INSERT INTO t1 VALUES (2); |
24 |
| -INSERT INTO t1 VALUES (3); |
25 |
| -ERROR HY000: Error writing file <tmp_file_name> (Errcode: ##) |
| 36 | +INSERT INTO t1 VALUES (repeat('a', 8192)); |
| 37 | +SET SESSION debug = "+d,simulate_error_during_flush_cache_to_file"; |
26 | 38 | ROLLBACK;
|
27 |
| -SET SESSION debug= "-d,simulate_tmpdir_partition_full"; |
| 39 | +SET SESSION debug = "-d,simulate_error_during_flush_cache_to_file"; |
28 | 40 |
|
29 |
| -# Case 1.3 COMMIT |
| 41 | +# Case 3 CLIENT DISCONNECT. it is same to ROLLBACK |
30 | 42 | BEGIN;
|
31 |
| -INSERT INTO t1 VALUES (1); |
32 |
| -SET SESSION debug= "+d,simulate_tmpdir_partition_full"; |
33 |
| -INSERT INTO t1 VALUES (2); |
34 |
| -INSERT INTO t1 VALUES (3); |
35 |
| -ERROR HY000: Error writing file <tmp_file_name> (Errcode: ##) |
36 |
| -COMMIT; |
37 |
| -ERROR HY000: Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server. |
38 |
| -include/assert_grep.inc [An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'.] |
39 |
| -include/assert.inc [Count of elements in t1 should be 0.] |
40 |
| -include/assert.inc [Query is not binlogged as expected.] |
41 |
| -TRUNCATE TABLE t1; |
42 |
| - |
43 |
| -# Case 2 (binlog_error_action = IGNORE_ERROR) |
| 43 | +INSERT INTO t1 VALUES (repeat('a', 8192)); |
| 44 | +SET SESSION debug = "+d,simulate_error_during_flush_cache_to_file"; |
44 | 45 |
|
45 |
| -RESET MASTER; |
46 |
| -SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 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; |
47 | 53 | BEGIN;
|
48 |
| -INSERT INTO t1 VALUES (1); |
49 |
| -SET SESSION debug= "+d,simulate_tmpdir_partition_full"; |
50 |
| -INSERT INTO t1 VALUES (2); |
51 |
| -INSERT INTO t1 VALUES (3); |
52 |
| -ERROR HY000: Error writing file <tmp_file_name> (Errcode: ##) |
| 54 | +INSERT INTO t1 VALUES (repeat('a', 8192)); |
| 55 | +SET SESSION debug = "+d,simulate_tmpdir_partition_full"; |
53 | 56 | COMMIT;
|
54 | 57 | Warnings:
|
55 |
| -Error 3 Error writing file MYSQLTEST_VARDIR/tmp/temp_file (Errcode: ##) |
56 |
| -Error 1026 Error writing file MYSQLTEST_VARDIR/tmp/temp_file (Errcode: ##) |
57 |
| -SET SESSION debug= "-d,simulate_tmpdir_partition_full"; |
58 |
| -include/assert.inc [Count of elements in t1 should be 2.] |
59 |
| -SHOW BINARY LOGS; |
60 |
| -ERROR HY000: You are not using binary logging |
| 58 | +Error 3 Error writing file <tmp_file_name> (Errcode: ##) |
| 59 | +Error 1026 Error writing file <tmp_file_name> (Errcode: ##) |
| 60 | +SET SESSION debug = "-d,simulate_tmpdir_partition_full"; |
61 | 61 | include/assert_grep.inc [An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'IGNORE_ERROR'.]
|
62 | 62 | # restart
|
63 |
| -include/assert.inc [Count of elements in t1 should be 2.] |
64 |
| -DROP TABLE t1; |
| 63 | +include/show_binlog_events.inc |
| 64 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 65 | +binlog.000001 # Stop # # |
| 66 | + |
| 67 | +# Case 5 Simulate write failure when reinitializing binlog cache for |
| 68 | +# copying to binlog with ABORT_SERVER |
| 69 | +# |
| 70 | +SET GLOBAL binlog_cache_size = 4096; |
| 71 | +select @@global.binlog_cache_size; |
| 72 | +@@global.binlog_cache_size |
| 73 | +4096 |
| 74 | +TRUNCATE t2; |
| 75 | +include/save_binlog_position.inc |
| 76 | +SET GLOBAL binlog_error_action = ABORT_SERVER; |
| 77 | +BEGIN; |
| 78 | +INSERT INTO t2 VALUES (repeat('b', 8192)); |
| 79 | +SET SESSION debug = "+d,simulate_tmpdir_partition_full"; |
| 80 | +COMMIT; |
| 81 | +ERROR HY000: Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server. |
| 82 | +# restart |
| 83 | +select * from t2; |
| 84 | +c1 |
| 85 | +include/assert.inc [Count of elements in t2 should be 0.] |
| 86 | +include/show_binlog_events.inc |
| 87 | +DROP TABLE t1, t2, t3; |
65 | 88 | RESET MASTER;
|
0 commit comments