知识卡片

支付系统案例卡 · 10294.a.4.a.2.a · 生成模型:未记录

并发取款写偏斜

理解等级:中级

两账户分别有 100 和 150,单户可负但合计须非负。两个并发事务各从一个账户取 200,各自基于合计 250 判断取款合法。两事务更新不同账户,合计约束却依赖两个账户的读集合,合并生效后余额 −100 与 −50,合计 −150。

参见 [[可串行化防止取款偏斜]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Database Internals》Chapter 5. Transaction Processing and Recovery(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch05.html#read_write_anomalies,段 159) - 结论依据:第 159 段给出完整金额、检查条件与并发失败结果。 - 原始内容:A1 starts with 100$ and A2 starts with 150$. The account value is allowed to be negative, as long as the sum of the two accounts is nonnegative: A1 + A2 >= 0.