知识卡片
分步自增难保证时间顺序
多台数据库用不同起点和固定步长产生不重叠序列,可分摊 ID 生成压力;但跨节点 ID 不一定按实际时间递增,增减机器也复杂。唯一、可扩容与按时间排序是不同约束。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 唯一ID · 查看原书依据
Multi-master replication As shown in Figure 7-2, the first approach is multi-master replication. This approach uses the databases’ auto_increment feature. Instead of increasing the next ID by 1, we increase it by k, where k is the number of database servers in use. As illustrated in Figure 7-2, next ID to be generated is equal to the previous ID in the same server plus 2.
参考来源
- 位置:《System Design Interview – An insiders guide, Second Edition》第07章《唯一ID》(来源项目 book-sources;源文件:extracted/System Design Interview – An insiders guide, Second Edition/_epub-src/text/part0019_split_002.html)
- 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。
- 原始内容:Multi-master replication As shown in Figure 7-2, the first approach is multi-master replication. This approach uses the databases’ auto_increment feature. Instead of increasing the next ID by 1, we increase it by k, where k is the number of database servers in use. As illustrated in Figure 7-2, next ID to be generated is equal to the previous ID in the same server plus 2.