知识卡片
复制写以根切换发布
更新时复制目标叶页和必须指向新页的祖先,未改的子树继续共享。新路径完整后原子切换根。已有读者沿旧根看到旧树,新读者看到新树;旧读者全部退出后,才可回收不再被引用的旧页。代价是整页复制与短时双份空间,树浅时路径成本较小。
结构图:
flowchart LR
O[旧根] --> L[旧叶页]
N[新根] --> W[修改后的叶页]
O --> S[共享未改子树]
N --> S
W --> P[全部就绪后切换根指针]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 6. B-Tree Variants Chapter 6. B-Tree Variants · 查看原书依据
Old tree versions remain accessible for readers that run concurrently to the writer, while writers accessing modified pages have to wait until preceding write operations are complete.
参考来源
- 位置:《Database Internals》Chapter 6. B-Tree Variants(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch06.html#copy_on_write_b_tree,段 11)
- 结论依据:第 10–14 段说明并行版本、原子发布、页回收和成本。
- 原始内容:Old tree versions remain accessible for readers that run concurrently to the writer, while writers accessing modified pages have to wait until preceding write operations are complete.