Oracle 审核 docs/design.md Section 3.2 WAL
docs/design.md
Section 3.2 "Physical Record 解析规则" 尾部损坏处理(~line 495)
Recovery 允许截断最后一个 segment 的尾部损坏。但截断操作本身(ftruncate + 删除后续空 segment)需要 fsync 才能在再次崩溃时保持一致性。设计文档未说明截断后的持久化步骤。
ftruncate
如果在截断后、fsync 前再次崩溃,recovery 会再次看到未截断的尾部损坏,可能重复截断或产生其他不一致。
在 "恢复完成状态" 之后或 "Recovery 扫描流程" 末尾添加截断持久化步骤:
lastCompleteBatchEnd
fsync
startSequence == expectedSequence
以上完成后,引擎才能开始接受新写入。
No dependencies set.
The note is not visible to the blocked user.
来源
Oracle 审核
docs/design.mdSection 3.2 WAL位置
Section 3.2 "Physical Record 解析规则" 尾部损坏处理(~line 495)
问题描述
Recovery 允许截断最后一个 segment 的尾部损坏。但截断操作本身(
ftruncate+ 删除后续空 segment)需要 fsync 才能在再次崩溃时保持一致性。设计文档未说明截断后的持久化步骤。如果在截断后、fsync 前再次崩溃,recovery 会再次看到未截断的尾部损坏,可能重复截断或产生其他不一致。
建议修复
在 "恢复完成状态" 之后或 "Recovery 扫描流程" 末尾添加截断持久化步骤:
ftruncateactive segment 到lastCompleteBatchEndfsynctruncated segmentstartSequence == expectedSequence但无 complete batch 的后续空 segmentfsyncWAL directoryfsyncmetadata directory以上完成后,引擎才能开始接受新写入。