-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
mvcc: fix a deadlock bug in mvcc #11817
Conversation
af93154
to
aeaf189
Compare
select { | ||
case <-s.stopc: | ||
default: | ||
s.mu.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document this why this is safe? (e.g. s.stopc
is only updated in restore operation, which is called by apply snapshot call, compaction and apply snapshot requests are serialized by raft, and do not happen at the same time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.updated.
aeaf189
to
a7423f2
Compare
When the cluster has more write requests, there is a certain probability to trigger this deadlock bug, will we backport it to 3.4 / 3.3 ?thanks. @gyuho |
Do you have any other suggestions for a solution to this problem?thanks. @gyuho |
@tangcong Thanks for the update. LGTM. Let's backport to 3.4 and 3.3. |
…17-origin-release-3.3 Automated cherry pick of #11817 on release-3.3
…17-origin-release-3.4 Automated cherry pick of #11817 on release-3.4
gorountine A(restore snapshot):
gorountine B(compact job):
A is holding lock and closed stopc chan, waiting for the schedule job to end.
B is doing compaction job, but stopc is closed,then return false, call compactBarrier, but A holded lock, so deadlock occurs.