Bug #52691 | innodb_trx shows trx_query as NULL after lock_wait_timeout and in other cases | ||
---|---|---|---|
Submitted: | 8 Apr 2010 13:32 | Modified: | 29 Jun 2011 23:02 |
Reporter: | Sergey Petrunya | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server: InnoDB Plugin storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1.45, 5.5.12, 5.6.3 | OS: | Any (linux) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[8 Apr 2010 13:32]
Sergey Petrunya
[8 Apr 2010 14:26]
MySQL Verification Team
Thank you for the bug report. C:\DBS>c:\dbs\5.1\bin\mysql -uroot --port=3306 --prompt="mysql 5.1 >" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.1.46-Win X64-log Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.1 >use information_schema Database changed mysql 5.1 >select * from innodb_trx; +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+---------------------------------+ | trx_id | trx_state | trx_started | trx_requested_lock_id | trx_wait_started | trx_weight | trx_mysql_thread_id | trx_query | +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+---------------------------------+ | 8022 | LOCK WAIT | 2010-04-08 11:23:14 | 8022:0:1218:2 | 2010-04-08 11:23:14 | 2 | 5 | update t1 set a=1230 where pk=1 | | 8021 | RUNNING | 2010-04-08 11:22:38 | NULL | NULL | 4 | 4 | NULL | +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+---------------------------------+ 2 rows in set (0.00 sec) mysql 5.1 >select * from innodb_trx; +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+-----------+ | trx_id | trx_state | trx_started | trx_requested_lock_id | trx_wait_started | trx_weight | trx_mysql_thread_id | trx_query | +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+-----------+ | 8023 | LOCK WAIT | 2010-04-08 11:23:57 | 8023:0:1218:2 | 2010-04-08 11:23:57 | 2 | 5 | NULL | | 8021 | RUNNING | 2010-04-08 11:22:38 | NULL | NULL | 4 | 4 | NULL | +--------+-----------+---------------------+-----------------------+---------------------+------------+---------------------+-----------+ 2 rows in set (0.00 sec)
[8 Apr 2010 15:44]
Vasil Dimov
The relevant code from trx/trx0i_s.c is: 462 if (trx->mysql_query_str != NULL && *trx->mysql_query_str != NULL) { 463 464 if (strlen(*trx->mysql_query_str) 465 > TRX_I_S_TRX_QUERY_MAX_LEN) { 466 467 char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1]; 468 469 memcpy(query, *trx->mysql_query_str, 470 TRX_I_S_TRX_QUERY_MAX_LEN); 471 query[TRX_I_S_TRX_QUERY_MAX_LEN] = '\0'; 472 473 row->trx_query = ha_storage_put_memlim( 474 cache->storage, query, 475 TRX_I_S_TRX_QUERY_MAX_LEN + 1, 476 MAX_ALLOWED_FOR_STORAGE(cache)); 477 } else { 478 479 row->trx_query = ha_storage_put_str_memlim( 480 cache->storage, *trx->mysql_query_str, 481 MAX_ALLOWED_FOR_STORAGE(cache)); 482 } 483 484 if (row->trx_query == NULL) { 485 486 return(FALSE); 487 } 488 } else { 489 490 row->trx_query = NULL; 491 }
[8 Apr 2010 21:38]
Sergey Petrunya
It seems lock_wait_timeout is not necessary to observe the effect. I also don't see the query text for LOAD DATA INFILE statement: mysql> select * from innodb_trx; +--------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+ | trx_id | trx_state | trx_started | trx_requested_lock_id | trx_wait_started | trx_weight | trx_mysql_thread_id | trx_query | +--------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+ | 30C | RUNNING | 2010-04-09 01:34:37 | NULL | NULL | 1064611 | 3 | NULL | +--------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+ 1 row in set (0.00 sec) mysql> show processlist; +----+------+-----------+--------------------+---------+------+-------+--------------------------------------------------------------------------------------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+--------------------+---------+------+-------+--------------------------------------------------------------------------------------------------+ | 2 | root | localhost | information_schema | Query | 0 | NULL | show processlist | | 3 | root | localhost | dbt3sf10 | Query | 45 | NULL | LOAD DATA LOCAL INFILE '/home/psergey/partsupp.tbl' into table partsupp fields terminated by '|' | +----+------+-----------+--------------------+---------+------+-------+--------------------------------------------------------------------------------------------------+
[18 Oct 2010 14:34]
Vasil Dimov
Hello, I cannot repeat this with latest 5.1/plugin or 5.5, I always get: 17:30:45 mysql> select trx_id, trx_state, trx_query from innodb_trx; +--------+-----------+---------------------------------+ | trx_id | trx_state | trx_query | +--------+-----------+---------------------------------+ | 5507 | LOCK WAIT | update t1 set a=1230 where pk=1 | | 5505 | RUNNING | NULL | +--------+-----------+---------------------------------+ 2 rows in set (0.01 sec)
[20 Oct 2010 7:25]
Vasil Dimov
I also cannot repeat with LOAD DATA INFILE in 5.1/plugin: client1: mysql> begin; select * from bug52691 for update; Query OK, 0 rows affected (0.00 sec) client2: mysql> load data infile 'bug52691.txt' into table bug52691; (hangs) client3: mysql> select trx_id, trx_state, trx_query from innodb_trx; +--------+-----------+-----------------------------------------------------+ | trx_id | trx_state | trx_query | +--------+-----------+-----------------------------------------------------+ | 570D | LOCK WAIT | load data infile 'bug52691.txt' into table bug52691 | | 570C | RUNNING | NULL | +--------+-----------+-----------------------------------------------------+ 2 rows in set (0.00 sec)
[27 Mar 2011 6:55]
MySQL Verification Team
Vasil, Sergey, see this valgrind output during a generic dml test. can it be the cause here?
Attachment: bug52691_valgrind_5.6.3_innodb_trx.txt (text/plain), 7.80 KiB.
[28 Mar 2011 9:26]
Vasil Dimov
Shane, very useful analysis. I have committed a change in vasil.dimov@oracle.com-20110328083412-odusry0rkbeenhd1 (see http://lists.mysql.com/commits/133991) which will probably fix that valgrind warning. Sergey, can you check whether it has also fixed this bug? Or if you can reproduce the bug at all because I couldn't last time I tried.
[28 Apr 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[16 May 2011 16:50]
Sveta Smirnova
Shane, could you please send us DML test which you used?
[23 May 2011 5:48]
MySQL Verification Team
sveta: in my homedir on shella you can find zlibdml.php. Run this in a few threads while repeatedly selecting from innodb_trx. Run mysqld in valgrind if needed if needed. Any insert/delete/update/select can be used, it doesn't really matter.
[26 May 2011 11:09]
Sveta Smirnova
I managed to repeat valgrind warnings in version 5.1.56, but can not repeat them anymore with 5.1.57. I also noticed InnoDB takes less locks in 5.1.57. Sergey, please check if issue which you reported solved as well. Thanks in advance.
[29 May 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[30 Jun 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[4 Jul 2011 8:06]
MySQL Verification Team
I don't see anything in the 5.1.57 change history that might explain why this is not repeatable?
[21 Nov 2018 10:51]
Jenkins Hudson
Still reproduce in 5.7.23
[30 Nov 2022 12:46]
Ben Kuhl
I'm encountering this issue on 8.0.20, which causes table locking and query backups on my database. This is visible in an RDS instance by spikes in wait/io/table/sql/handler on Performance Insights.