知识卡片
操作日志不等于事件真源
业务库与文本日志是两次写入,可能一方成功另一方失败;同事务写日志表虽解决原子性,仍可能漏写业务语义;触发器历史表能自动记录字段变化,却常缺少变化原因。事件溯源让事件本身成为写入真源,状态由其推导,从结构上要求业务变化有对应事件。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 建模时间维度 · 查看原书依据
Writing data both to an operational database and to a logfile is an error-prone operation. In its essence, it’s a transaction against two storage mechanisms: the database and the file. If the first one fails, the second one has to be rolled back. For example, if a database transaction fails, no one cares to delete
参考来源
- 位置:《Learning Domain-Driven Design》第7章《建模时间维度》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch07.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:Writing data both to an operational database and to a logfile is an error-prone operation. In its essence, it’s a transaction against two storage mechanisms: the database and the file. If the first one fails, the second one has to be rolled back. For example, if a database transaction fails, no one cares to delete