知识卡片
释放必须校验持有版本
A持锁过期后B重新取得锁,若A只把“已锁”改为“空闲”,就可能释放B的锁并让C进入。释放请求应携带本次取得锁的版本或唯一身份,并在存储端原子比较;版本不符意味着本次所有权已失效。只比较相同布尔值无法区分两代持有者。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 10. Ownership Election · 查看原书依据
By adding TTL to our locks, we have actually introduced a bug into our unlock function. Consider the following scenario: Process-1 obtains the lock with TTL t. Process-1 runs really slowly for some reason, for longer than t. The lock expires. Process-2 acquires the lock, since
参考来源
- 位置:《Designing Distributed Systems, 2nd Edition》第10章《Chapter 10. Ownership Election》(来源项目 book-sources;源文件:extracted/Designing Distributed Systems, 2nd Edition/_epub-src/OEBPS/ch10.html)
- 结论依据:原文A过期/B接管/A释放/C取得的序列说明资源版本前置条件必要性。
- 原始内容:By adding TTL to our locks, we have actually introduced a bug into our unlock function. Consider the following scenario: Process-1 obtains the lock with TTL t. Process-1 runs really slowly for some reason, for longer than t. The lock expires. Process-2 acquires the lock, since