知识卡片
聚合版本防止覆盖
两个进程读到相同聚合状态并分别决策,后提交者若直接覆盖,会丢失先提交的变化。为聚合保存版本,提交时要求当前版本等于读取版本,再原子更新状态并递增版本;不匹配就报告并发冲突,重新读取和决策。方法内校验无法替代持久化时的并发检查。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 应对复杂业务逻辑 · 查看原书依据
If multiple processes are concurrently updating the same aggregate, we have to prevent the latter transaction from blindly overwriting the changes committed by the first one. In such a case, the second process has to be notified that the state on which it had based its decisions is out of date, and it has to
参考来源
- 位置:《Learning Domain-Driven Design》第6章《应对复杂业务逻辑》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch06.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:If multiple processes are concurrently updating the same aggregate, we have to prevent the latter transaction from blindly overwriting the changes committed by the first one. In such a case, the second process has to be notified that the state on which it had based its decisions is out of date, and it has to