polardbxengine/mysql-test/suite/xengine_binlog/r/binlog_cache_write_failure....

89 lines
3.3 KiB
Plaintext

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,simulate_tmpdir_partition_full";
COMMIT;
Warnings:
Error 3 Error writing file <tmp_file_name> (Errcode: ##)
Error 1026 Error writing file <tmp_file_name> (Errcode: ##)
SET SESSION debug = "-d,simulate_tmpdir_partition_full";
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,simulate_tmpdir_partition_full";
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'. Hence aborting the server.
# 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;