Bug #115706 use database doesn't work
Submitted: 28 Jul 2024 8:39 Modified: 10 Mar 19:28
Reporter: csg sz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.4 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression, use database doesn't work

[28 Jul 2024 8:39] csg sz
Description:
I started by executing the following statement in session 1:
mysql> use test;
mysql> begin;
mysql> select * from t22;

Then execute the following statement in session 2:
mysql> drop table t22;   ------It'll hang here.

Finally, execute the following statement in session 3:
mysql -uroot -p
mysql> use test; ------It'll hang here.I think it's a bug.I can't get into the database.

How to repeat:
I started by executing the following statement in session 1:
mysql> use test;
mysql> begin;
mysql> select * from t22;

Then execute the following statement in session 2:
mysql> drop table t22;   ------It'll hang here.

Finally, execute the following statement in session 3:
mysql -uroot -p
mysql> use test; ------It'll hang here.I think it's a bug.I can't get into the database.
[29 Jul 2024 9:41] MySQL Verification Team
Hi Mr. sz,

Thank you for your bug report.

However, we can not repeat it with out official binary for 8.4.2.

Yes, of course, drop table was blocked. It is expected behaviour. That is how MDL work.

But , using test schema went without any problems.

Can't repeat.
[29 Jul 2024 14:09] MySQL Verification Team
HI Mr. sz,

Actually, 8.4.2 has this bug, which 8.4.1 did not have !!!!

Thank you for your test case !!!!!

Verified as reported.
[29 Jul 2024 14:23] MySQL Verification Team
This bug affects latest 8.4 and 9.0.

It does not affect latest 8.0, which is 8.0.39.
[10 Mar 19:28] Daniel So
Posted by developer:
 
Added the following entry to the MySQL 9.4.0 and 8.4.5 changlogs:

"If one client session had a uncommitted transaction that caused a DROP TABLE statement in another client session to be blocked, a third client session hung when trying to issue a USE DATABASE statement."
[17 Mar 19:57] Daniel So
Posted by developer:
 
Move the changelog entry from the 9.4.0 to the 9.3.0 changelog.