Skip to content

Commit 21973d0

Browse files
MDEV-22953 main.flush_read_lock failed in buildbot with XAER_NOTA: Unknown XID
Issue:- Since there is no waiting for the actual disconnection of the con_tmp (which does XA prepare of test1), We can have a issue when test1 is not prepared and we are calling rollback on test1 , giving XAER_NOTA: Unknown XID error Solution:- Wait for the complete disconnection of con_tmp
1 parent df33b71 commit 21973d0

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

mysql-test/main/flush_read_lock.result

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,19 +1383,22 @@ insert into t3_trans values (1);
13831383
xa end 'test1';
13841384
xa prepare 'test1';
13851385
# Disconnect temporary connection
1386+
set debug_sync='thread_end SIGNAL test1_prepare';
13861387
disconnect con_tmp;
1388+
connection con1;
1389+
set debug_sync='now WAIT_FOR test1_prepare';
13871390
# Create temporary connection for XA transaction.
1388-
connect con_tmp,localhost,root,,;
1391+
connect con_tmp1,localhost,root,,;
13891392
xa start 'test2';
13901393
insert into t3_trans values (2);
13911394
xa end 'test2';
13921395
xa prepare 'test2';
13931396
# Disconnect temporary connection
1394-
set debug_sync='thread_end SIGNAL detached';
1395-
disconnect con_tmp;
1397+
set debug_sync='thread_end SIGNAL test2_prepare';
1398+
disconnect con_tmp1;
13961399
# Switching to connection 'con1'.
13971400
connection con1;
1398-
set debug_sync='now WAIT_FOR detached';
1401+
set debug_sync='now WAIT_FOR test2_prepare';
13991402
flush tables with read lock;
14001403
# Switching to connection 'default'.
14011404
connection default;

mysql-test/main/flush_read_lock.test

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,25 +1690,34 @@ insert into t3_trans values (1);
16901690
xa end 'test1';
16911691
xa prepare 'test1';
16921692
--echo # Disconnect temporary connection
1693+
set debug_sync='thread_end SIGNAL test1_prepare';
16931694
disconnect con_tmp;
1695+
connection $con_aux1;
1696+
set debug_sync='now WAIT_FOR test1_prepare';
1697+
1698+
16941699
--echo # Create temporary connection for XA transaction.
1695-
connect (con_tmp,localhost,root,,);
1700+
connect (con_tmp1,localhost,root,,);
16961701
xa start 'test2';
16971702
insert into t3_trans values (2);
16981703
xa end 'test2';
16991704
xa prepare 'test2';
17001705
--echo # Disconnect temporary connection
1701-
set debug_sync='thread_end SIGNAL detached';
1702-
disconnect con_tmp;
1706+
set debug_sync='thread_end SIGNAL test2_prepare';
1707+
disconnect con_tmp1;
1708+
1709+
17031710
--echo # Switching to connection '$con_aux1'.
17041711
connection $con_aux1;
1705-
set debug_sync='now WAIT_FOR detached';
1712+
set debug_sync='now WAIT_FOR test2_prepare';
17061713
flush tables with read lock;
1714+
17071715
--echo # Switching to connection 'default'.
17081716
connection default;
17091717
--echo # Send XA ROLLBACK 'test1'
17101718
--send xa rollback 'test1'
17111719
--echo # Switching to connection '$con_aux1'.
1720+
17121721
connection $con_aux1;
17131722
--echo # Wait until XA ROLLBACK is blocked.
17141723
let $wait_condition=

0 commit comments

Comments
 (0)