-
Notifications
You must be signed in to change notification settings - Fork 42
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
Resolve potential deadlocks #438
Conversation
jschwinger233
commented
Jun 22, 2021
- 上多锁前给锁排序
- 如果出现 withNodesLocked + withWorkloadsLocked, 保证先锁节点再锁 workloads
- 解锁时候逆序解锁
983b729
to
9e24bc2
Compare
cluster/calcium/lock.go
Outdated
// force unlock | ||
if err := c.doUnlock(ctx, lock, n); err != nil { | ||
log.Errorf(ctx, "[doUnlockAll] Unlock failed %v", err) | ||
func (c *Calcium) doUnlockAll(ctx context.Context, locks map[string]lock.DistributedLock, order []string) { |
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.
为了兼容性你不如 order string...
29ec032
to
a5500b3
Compare
cluster/calcium/lock.go
Outdated
defer func() { c.doUnlockAll(utils.InheritTracingInfo(ctx, context.Background()), locks) }() | ||
defer func() { | ||
utils.Reverse(ids) | ||
c.doUnlockAll(utils.InheritTracingInfo(ctx, context.Background()), locks, ids...) |
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.
background?
cluster/calcium/lock.go
Outdated
defer c.doUnlockAll(utils.InheritTracingInfo(ctx, context.Background()), locks) | ||
defer func() { | ||
utils.Reverse(nodenames) | ||
c.doUnlockAll(utils.InheritTracingInfo(ctx, context.Background()), locks, nodenames...) |
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.
same here
a5500b3
to
bd34822
Compare