知识卡片
悲观锁先协调再操作
悲观锁在访问冲突资源前取得锁:共享锁允许共同读,排他锁限制冲突修改。高冲突时可避免反复失败重做,但持锁长会排队,也要处理死锁。具体哪些读会阻塞仍取决于数据库隔离与MVCC实现。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Consistency and Availability · 查看原书依据
Pessimistic locking follows a conservative approach, assuming that conflicts are likely to occur and proactively taking measures to prevent them. Before accessing or modifying a shared resource, a transaction must acquire a lock on that resource.
参考来源
- 位置:《Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…》第04章《Consistency and Availability》(来源项目book-sources;源文件:extracted/Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…/_epub-src/OPS/ch04.xhtml)
- 结论依据:原文的机制或对比支持以下核心判断:悲观锁在访问冲突资源前取得锁:共享锁允许共同读,排他锁限制冲突修改。 本卡将相邻说明中的适用限制保留为解释。
- 原始内容:Pessimistic locking follows a conservative approach, assuming that conflicts are likely to occur and proactively taking measures to prevent them. Before accessing or modifying a shared resource, a transaction must acquire a lock on that resource.