Bug #69141 | SELECT from InnoDB table hangs being run in parallel with replicating LOAD DATA | ||
---|---|---|---|
Submitted: | 3 May 2013 22:56 | Modified: | 19 Sep 2013 18:23 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6-debug, 5.7-debug | OS: | Linux (Ubuntu 12.04 64-bit) |
Assigned to: | Annamalai Gurusami | CPU Architecture: | Any |
[3 May 2013 22:56]
Elena Stepanova
[4 May 2013 6:21]
MySQL Verification Team
Setting to verified. The stack trace looks like http://bugs.mysql.com/bug.php?id=68069 ! In my test, the load data on master took 1min 20s. Issuing a normal select count(*) takes ~16 seconds. But when hitting this bug on slave, it still hangs, long after the load data finished as we see: | Command | Time | State | Info +---------+------+-----------------------------------------------------------------------------+------------------------- | Connect | 1050 | Waiting for master to send event | NULL | Connect | 912 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL | Query | 820 | Sending data | select count(*) from t1 | Query | 0 | init | show processlist +---------+------+-----------------------------------------------------------------------------+-------------------------
[4 May 2013 6:21]
MySQL Verification Team
5.6.11-debug stack
Attachment: bug69141_stack.txt (text/plain), 4.55 KiB.
[4 May 2013 7:17]
MySQL Verification Team
alas, it is still running: Connect | 4322 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL Query | 4230 | Sending data | select count(*) from t1 Query | 0 | init | show processlist
[18 Sep 2013 19:34]
Bugs System
Noted in 5.6.15, 5.7.3 changelog. A "SELECT COUNT (*)" query would run very slowly when run concurrently with a "LOAD DATA" operation.
[19 Sep 2013 18:23]
Elena Stepanova
Hi, just wondering -- does "very slowly" mean that somebody actually saw it finish, or is it just a nice alias for hanging? (It might be in private comments, but mind you, we don't see those).
[20 Sep 2013 4:14]
Annamalai Gurusami
Hi Elena, I am the one who worked on this bug. Yes, the query was not hanging. It completed in 1 hour 16 min 36.10 sec! The root cause was a O(n2) loop in mtr_memo_contains(), which is now changed to O(n) loop. Rgds, anna
[4 Dec 2013 11:35]
Laurynas Biveinis
5.6$ bzr log -r 5457 ------------------------------------------------------------ revno: 5457 committer: Annamalai Gurusami <annamalai.gurusami@oracle.com> branch nick: mysql-5.6 timestamp: Tue 2013-09-17 17:23:58 +0530 message: Bug #16764240 SELECT FROM INNODB TABLE HANGS BEING RUN IN PARALLEL WITH REPLICATING LOAD DATA Problem: The mtr_memo_contains() function determines if the given object is part of the memo of the mini transaction. In the test scenario, this search is very slow (takes more than 1 hour). This is because the search in mtr_memo_contains() involves a nested loop. Solution: Re-write mtr_memo_contains() so that the search involves only one loop. This is already done by Yasufumi as part of wl#6363. Backporting the functions mtr_memo_contains() and mtr_memo_note_modifications() from mysql-5.7 to mysql-5.6 is sufficient. rb#3342 approved by Yasufumi
[16 Dec 2013 15:45]
Daniel Price
Bug text has been revised for 5.6.15, 5.7.3 changelog entries: "A "SELECT COUNT(*)" query would take a long time to complete when run concurrently with a "LOAD DATA" operation. The "mtr_memo_contains" function, which determines if an object is part of a memo in a mini transaction, contained a nested loop that caused the query to run slowly."