Bug #83483 xa transaction cause slave oom
Submitted: 22 Oct 2016 16:10 Modified: 24 Oct 2016 17:30
Reporter: Chengyao Jiang Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[22 Oct 2016 16:10] Chengyao Jiang
Description:
I find that using XA transaction in MySQL 5.7 will cause slave OOM. 

Our production environments are based on read/write split, which means almost read operation will send to slaves. Hence this is a big problem for us. 

How to repeat:
test script:

set @id:=floor(rand()*19999999+1);
xa start 'a';
update sbtest.sbtest1 set k = k + 1 where id = @id;
xa end 'a';
xa commit 'a' one phase;

run script on master: mysqlslap -q xa_oom.sql -c 1 --number-of-queries=100000

on slave: you will see a lot of transactions with not started state.

root@test-2:~# mysql -e"show engine innodb status\G" | grep "TRANSACTION" | wc -l
11296

and in error log, you will see following until oom happens:

[Note] InnoDB: Number of pools: 260
[Note] InnoDB: Number of pools: 261
[Note] InnoDB: Number of pools: 262
...
[24 Oct 2016 17:30] Chengyao Jiang
fixed