知识卡片
CRDT计数器按槽合并
每个副本只增加自己的槽,交换状态时按槽取最大,总数为各槽加总。两个状态 [1,0,0]、[0,0,1] 合并为 [1,0,1],读到 2,重复收到相同状态也不会再加一次。增加一组递减槽,以递增总和减递减总和,就得到 PN 计数器。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 11. Replication and Consistency Strong Eventual Consistency and CRDTs · 查看原书依据
For example, we could implement a grow-only counter. Each server can hold a state vector consisting of last known counter updates from all other participants, initialized with zeros. Each server is only allowed to modify its own value in
参考来源
- 位置:《Database Internals》Chapter 11. Replication and Consistency(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch11.html#idm46104530060792,段 221)
- 结论依据:原文完整演算 G-Counter,再引出两向量的 PN-Counter。
- 原始内容:For example, we could implement a grow-only counter. Each server can hold a state vector consisting of last known counter updates from all other participants, initialized with zeros. Each server is only allowed to modify its own value in