MNesia 是否支持断线操作后同步?
我开始构建一个具有以下要求的项目:
- 整个系统将分布在 WAN 上的多个物理节点上
- 每个节点将使用和操作一组通用的数据记录
- 对这些记录的操作必须能够适应网络
中断正在考虑利用 Mnesia/Erlang 作为该项目的基础平台,但我想知道它 (Mnesia) 能够如何很好地处理数据集上同时断开的冲突操作。
示例场景:
- 节点 A 和 B 具有连接性和空数据集。
- 节点 A 添加记录 (1, ABC)。
- 这里,记录集应该透明同步,现在节点 B 也有记录 (1, ABC)。
- 它们之间的网络连接丢失。
- 节点 A 将记录更改为 (1, DEF)。
- 节点 B(稍后的时间戳)将记录更改为 (1, GHI)。
- 网络连接已恢复
- 预期:透明同步后,两个节点都包含记录 (1, GHI)。
为简化起见,我们假设不需要完整的更改历史记录(例如,记录 1 过去是否包含 ABC 或 DEF 并不重要,重要的是它现在包含 GHI)。
这是 Mnesia 开箱即用(或实现起来很简单)的功能吗?
I'm starting to architect a project with the following requirements:
- The overall system will be distributed across multiple physical nodes on a WAN
- Each node will be using and manipulating a common set of data records
- Operations on these records must be resilient to network outages
I'm considering utilizing Mnesia/Erlang as the base platform for this project, but I'd like to know how well it (Mnesia) can handle simultaneous disconnected conflicting operations on the data set.
An illustrative scenario:
- Nodes A and B have connectivity and an empty data set.
- Node A adds record (1, ABC).
- Here, the record sets should transparently synchronize and now node B also has record (1, ABC).
- Network connectivity between them is lost.
- Node A alters the record to (1, DEF).
- Node B (later timestamp) alters the record to (1, GHI).
- Network connectivity is restored
- Expected: After a transparent synchronization, both nodes contain the record (1, GHI).
To simplify, let's assume that a complete change history is not required (e.g. it's not important that record 1 used to contain ABC or DEF, it's only important that it now contains GHI).
Is this an out-of-the-box (or trivial to implement) capability of Mnesia?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Ulf Wiger 上次在旧金山的 Erlang Factory(2010 年)就这个主题做了一次演讲。您可以在这里找到他的幻灯片:http://www.erlang- factory.com/upload/item/7/UlfWiger-10mintalk.pdf
它们包含问题的概述以及一些可能对您有用的源代码的指针。
Ulf Wiger had a talk last Erlang Factory in San Francisco (2010) on this topic. You can find his slides here: http://www.erlang-factory.com/upload/item/7/UlfWiger-10minutetalk.pdf
They contains an overview of the problems and also pointers to some source code that might be of use to you.
步骤 1-5 应该有效。自动冲突解决(第 6 步):否。
Steps 1-5 should work. Automatic conflict resolution (step 6): no.