mariadb/mysql-test/suite/innodb/r/xa_recovery_debug.result
Marko Mäkelä b1742a5c95 MDEV-13626: Improve innodb.xa_recovery_debug
Improve the test that was imported and adapted for MariaDB in
commit fb217449dc.

row_undo_step(): Move the DEBUG_SYNC point from trx_rollback_for_mysql().
This DEBUG_SYNC point is executed after rolling back one row.

trx_rollback_for_mysql(): Clarify the comments that describe the scenario,
and remove the DEBUG_SYNC point.

If the statement "if (trx->has_logged_persistent())" and its body are
removed from trx_rollback_for_mysql(), then the test
innodb.xa_recovery_debug will fail because the transaction would still
exist in the XA PREPARE state. If we allow the XA COMMIT statement
to succeed in the test, we would observe an incorrect state of the
XA transaction where the table would contain row (1,NULL). Depending
on whether the XA transaction was committed, the table should either
be empty or contain the record (1,1). The intermediate state of
(1,NULL) should never be observed after completed recovery.
2020-04-01 09:13:01 +03:00

26 lines
623 B
Text

#
# Bug#20872655 XA ROLLBACK IS NOT CRASH-SAFE
#
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=INNODB;
INSERT INTO t SET a=0;
connect con1,localhost,root;
XA START 'zombie';
INSERT INTO t SET a=1;
UPDATE t SET b=1 WHERE a=1;
SELECT COUNT(*) FROM t;
COUNT(*)
2
XA END 'zombie';
XA PREPARE 'zombie';
SET DEBUG_SYNC='trx_after_rollback_row SIGNAL s1 WAIT_FOR s2';
XA ROLLBACK 'zombie';
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t LIMIT 1;
disconnect con1;
XA COMMIT 'zombie';
ERROR XAE04: XAER_NOTA: Unknown XID
SELECT * FROM t;
a b
DROP TABLE t;