XA operations do not take global commit lock under LOCK TABLES FOR BACKUP

Bug #1712202 reported by Yura Sorokin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Invalid
Undecided
Unassigned
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

In 5.7.19 Oracle fixed Bug #84442 "XA PREPARE inconsistent with XTRABACKUP"
(https://bugs.mysql.com/bug.php?id=84442).
XA PREPARE, XA ROLLBACK, and XA COMMIT for a transaction from a
disconnected session did not take a global commit lock and modified
the binary log and InnoDB redo log even when FLUSH TABLES WITH READ
LOCK was in effect. This could lead to inconsistent backups when
backup tools assumed that the server was in a read-only state.

Similar changes must be implemented for Percona-specific LOCK TABLES FOR BACKUP / LOCK BINLOG FOR BACKUP.

In the following MTR test case fragment "xa prepare 'test1'" must fail with ER_LOCK_WAIT_TIMEOUT.

--echo # Check XA state when lock_wait_timeout happens
--echo # More tests added to flush_read_lock.test
connect (con_tmp,localhost,root,,);
set session lock_wait_timeout=1;
create table asd (a int);
xa start 'test1';
insert into asd values(1);
xa end 'test1';
connection default;

lock tables for backup;

connection con_tmp;
--echo # PREPARE error will do auto rollback.
--ERROR ER_LOCK_WAIT_TIMEOUT
xa prepare 'test1';
show errors;
connection default;
unlock tables;

Tags: backup-locks
Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

The full set of test cases can be found in Oracle's commit 25106b8
"Bug 25364178 - XA PREPARE INCONSISTENT WITH XTRABACKUP"
https://github.com/mysql/mysql-server/commit/25106b8

tags: added: backup-locks
Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

See also bug 1651941

Revision history for this message
Sveta Smirnova (svetasmirnova) wrote :

Thank you for the report.

Verified as described.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1817

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.