知识卡片
同库服务可在事务内回滚
当相关写入确实落在同一个数据库事务中,粗粒度服务可以使用提交与回滚保持这些写入的一致性。原书以订单和过期信用卡为例:付款校验失败时撤销此前加入数据库的订单数据。边界是单个事务实际覆盖的写入;外部支付调用若不参加该事务,不能仅靠本地回滚保证外部状态一致。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Service-Based Architecture Style · 查看原书依据
Since this payment is an atomic transaction within the same service, the service can remove everything added to the database so far using a standard transaction rollback.
参考来源
- 位置:《Fundamentals of Software Architecture》原书第14章《Service-Based Architecture Style》(阅读计划第17项;源文件:`OEBPS/ch14.html`)
- 结论依据:原文强调服务内常规 ACID 事务,并给出付款失败回滚订单数据的例子;外部调用边界为推断。
- 原始内容:Since this payment is an atomic transaction within the same service, the service can remove everything added to the database so far using a standard transaction rollback.