The table lock is not released until 60 seconds after a failed table cut
After waiting for AllEventsUpToLockProcessed to timeout, the database instance experienced a large amount of metadata waiting for 60 seconds。 Because the sentence "unlock tables" cannot be executed until 60 seconds
mysql version:8.0.24 ghost version: 1.1.5
the log:
2023-03-17 18:13:55 INFO Grabbing voluntary lock: gh-ost.34100417.lock
2023-03-17 18:13:55 INFO Setting LOCK timeout as 6 seconds
2023-03-17 18:13:55 INFO Looking for magic cut-over table
2023-03-17 18:13:55 INFO Creating magic cut-over table db1._test_20230317181349_del
2023-03-17 18:13:55 INFO Magic cut-over table created
2023-03-17 18:13:55 INFO Locking db1.test, db1._test_20230317181349_del
2023-03-17 18:13:55 INFO Tables locked
2023-03-17 18:13:55 INFO Session locking original & magic tables is 34100417
2023-03-17 18:13:55 INFO Writing changelog state: AllEventsUpToLockProcessed:1679048035119299226 2023-03-17 18:13:55 INFO Waiting for events up to lock 2023-03-17 18:13:58 ERROR Timeout while waiting for events up to lock 2023-03-17 18:13:58 ERROR 2023-03-17 18:13:58 ERROR Timeout while waiting for events up to lock
2023-03-17 18:13:58 INFO Looking for magic cut-over table
2023-03-17 18:13:58 INFO Will now proceed to drop magic table and unlock tables
2023-03-17 18:13:58 INFO Dropping magic cut-over table
2023-03-17 18:13:58 INFO Dropping magic cut-over table
2023-03-17 18:13:58 INFO Dropping table db1._test_20230317181349_del
2023-03-17 18:14:58 ERROR Error 1205: Lock wait timeout exceeded; try restarting transaction
2023-03-17 18:14:58 INFO Releasing lock from db1.test, db1._test_20230317181349_del
2023-03-17 18:14:58 INFO Tables unlocked
After AllEventsUpToLockProcessed to timeout, execute the following code:
The 'drop table_test_20230317181349_del' statement is waiting for a metadata lock until it defaults to waiting for 60 seconds for the metadata lock to exit.
The code marked in red waits until the above execution ends before executing the "UNLOCK TABLES" release table