知识卡片
本地回滚不撤销远程扣款
订单代码先预留库存并调用支付,再提交本地订单;本地提交失败后rollback不能自动撤销外部已成功扣款。先查幂等表再执行也存在并发窗口,示意代码不足以证明不会重复扣款或出现无订单支付。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Data Storage Strategies · 查看原书依据
This seemingly straightforward process becomes complex in a distributed environment. Each step involves different services, potentially running on different machines, each with its own database. We must ensure that all these operations either complete successfully together or fail completely, there cannot be a situation where we charge a customer's credit card but fail to create the order record.
参考来源
- 位置:《Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…》第09章《Data Storage Strategies》(来源项目book-sources;源文件:extracted/Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…/_epub-src/OPS/ch09.xhtml)
- 结论依据:原文的机制或对比支持以下核心判断:订单代码先预留库存并调用支付,再提交本地订单;本地提交失败后rollback不能自动撤销外部已成功扣款。 本卡将相邻说明中的适用限制保留为解释。
- 原始内容:This seemingly straightforward process becomes complex in a distributed environment. Each step involves different services, potentially running on different machines, each with its own database. We must ensure that all these operations either complete successfully together or fail completely, there cannot be a situation where we charge a customer's credit card but fail to create the order record.