Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lock hang at cut-over table stage #939

Open
cenkore opened this issue Mar 9, 2021 · 1 comment
Open

lock hang at cut-over table stage #939

cenkore opened this issue Mar 9, 2021 · 1 comment

Comments

@cenkore
Copy link

cenkore commented Mar 9, 2021

We met a lock hang at cut-over table stage recently. After analysis, I have a suspicion that it is related to the PR #888. The problem occurs handle Timeout while waiting for events up to lock in atomicCutOver(). After timeout error current atomicCutOver will be cancelled and try again. When canceled, defer func is executed, include okToUnlockTable <-true and this.applier.DropAtomicCutOverSentryTableIfExists(), also applier.AtomicCutOverMagicLock will drop magic cut-over table after recv okToUnlockTable channel. so the PR use sync.Once to avoid to send drop cutover sentry table to mysql twice, But if the drop table operation executed by applier.DropAtomicCutOverSentryTableIfExists() first, it will be locked with Waiting for table metadata lock, while the actual lock owner applier.AtomicCutOverMagicLock is stuck here (Once mutex lock), Waiting for the completion of the former.

This can be reproduced by injecting some problems,at here force a timeout error before waiting for the event to be locked, and Wait a few seconds here to make sure that the delete table is invoking by DropAtomicCutOverSentryTableIfExists().

Thank you!

@vleejl
Copy link

vleejl commented Feb 10, 2023

@cenkore Hello,is it possible to move the delete table action to the defer function of AtomicCutOverMagicLock?This enables the creation and release of sentry table in the same coroutine, and avoid this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants