github / github/gh-ost

The table lock is not released until 60 seconds after a failed table cut

Open
#1,270 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

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.**
image

**The code marked in red waits until the above execution ends before executing the "UNLOCK TABLES" release table**
image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.