76 lines
2.8 KiB
Plaintext
76 lines
2.8 KiB
Plaintext
###############################################################################
|
|
# Bug#21276561: FAILURE TO GENERATE GTID LEADS TO INCONSISTENCY
|
|
#
|
|
# Problem:
|
|
# =======
|
|
# If generating a GTID for a transaction fails, the transaction is not written
|
|
# to the binary log but still gets committed, which potentially leads to
|
|
# master/slave data inconsistency.
|
|
#
|
|
# Test:
|
|
# =====
|
|
# Simulate a scenario such that generation of GTID number reaches its maximum
|
|
# value and the new GTID cannot be generated because of that. Verify that this
|
|
# fatal error case is appropriately handled as per the binlog_error_action
|
|
# value specified by user.
|
|
###############################################################################
|
|
# This test case is binlog_format agnostic
|
|
--source include/have_binlog_format_statement.inc
|
|
# Don't test this under valgrind, memory leaks will occur
|
|
--source include/not_valgrind.inc
|
|
--source include/have_debug.inc
|
|
|
|
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");
|
|
|
|
#Test case 1:
|
|
SET GLOBAL binlog_error_action=IGNORE_ERROR;
|
|
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
# @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
|
|
# Hence execute RESET MASTER.
|
|
RESET MASTER;
|
|
SET GLOBAL gtid_purged = CONCAT(@@GLOBAL.server_uuid, ':1-9223372036854775805');
|
|
INSERT INTO t1 VALUES (1);
|
|
--error ER_GNO_EXHAUSTED
|
|
INSERT INTO t1 VALUES (2);
|
|
|
|
# Check that transaction is committed
|
|
--let $assert_cond = COUNT(*) = 2 FROM t1;
|
|
--let $assert_text = Count of elements in t1 should be 2.
|
|
--source include/assert.inc
|
|
--source include/restart_mysqld.inc
|
|
|
|
RESET MASTER;
|
|
DROP TABLE t1;
|
|
|
|
#Test case 2:
|
|
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
# @@GLOBAL.GTID_PURGED can only be set when the new value
|
|
# includes the old one and their set difference does not overlap with
|
|
# @@GLOBAL.GTID_EXECUTED.
|
|
# RESET MASTER empties the latter and the current purged set
|
|
# to satisfy the above condition.
|
|
RESET MASTER;
|
|
|
|
# BUG#20470724 owes this check of no binlog rotation after SET
|
|
--let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
|
|
SET GLOBAL gtid_purged = CONCAT(@@GLOBAL.server_uuid, ':1-9223372036854775805');
|
|
--let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
|
|
|
|
--let $assert_cond = "$binlog_file_0" = "$binlog_file_1"
|
|
--let $assert_text = Binlog file must not rotate after SET GTID_PURGED
|
|
--source include/assert.inc
|
|
|
|
INSERT INTO t1 VALUES (1);
|
|
SET GLOBAL binlog_error_action=ABORT_SERVER;
|
|
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--error ER_BINLOG_LOGGING_IMPOSSIBLE
|
|
INSERT INTO t1 VALUES (2);
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
RESET MASTER;
|
|
DROP TABLE t1;
|