Bug #109099 Unexpected delay in main.status test
Submitted: 15 Nov 2022 16:00 Modified: 16 Nov 2022 12:22
Reporter: Pavel Kopylov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version: OS:CentOS (CentOS Linux release 8.5.2111)
Assigned to: CPU Architecture:x86

[15 Nov 2022 16:00] Pavel Kopylov
Description:
I realized that the test main.status has an unexpected delay. This delay is determined by file include/wait_condition.inc (see the $wait_counter variable there). However, the test passed successfully, after the countdown finished.

I added a couple of rows to debug the issue (I've attached my patch that reveals things that happen).

Please pay attention to the output of the patched test. In the following output, my connection id is 9. However, the state for this connection id is "executing" instead of the expected state "Waiting for table level lock". That is why the test is waiting for an unexpected time. 

CURRENT_TEST: main.status
--- /home/user/rpmbuild/BUILD/mysql-8.0.30/mysql-test/r/status.result	2022-07-07 00:36:34.000000000 +0300
+++ /home/user/rpmbuild/BUILD/mysql-8.0.30/build/mysql-test/var/log/status.reject	2022-11-15 18:37:52.726662817 +0300
@@ -29,6 +29,15 @@
 update t1 set n = 3;
 # Switched to connection: default
 # wait for the second UPDATE to get blocked
+select * from INFORMATION_SCHEMA.PROCESSLIST;
+ID	USER	HOST	DB	COMMAND	TIME	STATE	INFO
+9	root	localhost	test	Query	0	executing	select * from INFORMATION_SCHEMA.PROCESSLIST
+10	root	localhost	test	Query	0	updating	update t1 set n = 3
+11	root	localhost	test	Query	0	User lock	update t1 set n = get_lock('mysqltest_lock', 100)
+5	event_scheduler	localhost	NULL	Daemon	1	Waiting on empty queue	NULL
+select connection_id();
+connection_id()
+9
 Timeout in wait_condition.inc for select 1 from INFORMATION_SCHEMA.PROCESSLIST
 where ID = (select connection_id()) and STATE = "Waiting for table level lock"
 select release_lock('mysqltest_lock');

mysqltest: Result content mismatch

How to repeat:
1. Apply attached patch (patch-to-debug.diff)
2. run test:
./mysql-test-run.pl  --mysqld=--binlog-format=mixed --max-test-fail=5 --report-unstable-tests --mysqld=--skip-innodb-use-native-aio main.status
[15 Nov 2022 16:01] Pavel Kopylov
patch to output some debug information

Attachment: patch-to-debug.diff (text/x-patch), 626 bytes.

[16 Nov 2022 12:22] MySQL Verification Team
Hi Mr. Kop,

Thank you for your bug report.

The status of "Executing" is correct.

That is because a thread is not waiting for the table lock, but for the named MDL lock. These locks are designed to be utilised within the application code. These are not table locks.

Not a bug.