gpt4 book ai didi

design-patterns - 两个相同关系数据库完全同步的设计模式

转载 作者:行者123 更新时间:2023-12-04 20:43:32 24 4
gpt4 key购买 nike

有人知道解决同步两个相同关系数据库的复杂性的设计模式吗?我在各种项目中不断遇到这个挑战,但找不到合适的模式来深入处理它。我面临的具体挑战是:

  • 相互依赖的表和记录的排序,特别是有两个表,每个表都有一个相互引用的外键
  • 确保两种模型一致
  • 并发性,其中一个模型的用户正在写入正忙于由同步 session 更新的模型
  • 在更改知识是假的情况下最小化开销,并且在执行更新时,数据没有更改
  • 行版本控制,从前一点开始,使用 rowversion 或时间戳列的行版本控制在更新期间更新行版本,即使没有数据更改。
  • 在同步 session 期间从异常回滚

  • 如果有人知道解决这些挑战的模式,甚至是堆栈,我很想听听你的想法。我曾尝试使用 MS Sync Framework,虽然它确实解决了数据同步中涉及的许多问题,但就上述挑战而言,它并不是一个完整的解决方案。

    最佳答案

    请检查

    Master-Master Row-Level Synchronization

    Context

    You are about to design a replication between a source and a target, as described in Master-Master Replication. Your requirements are:

    The replication set is updateable at either end of the replication.

    Updates need to be transmitted to the other party.

    Conflicts need to be detected and resolved at defined points in time, following defined data integrity rules.

    Potential conflicts in the changes are to be resolved at the row level.

    Solution

    Create a pair of related replication links between the source and target as described in the Master-Master Replication pattern. Additionally, create a synchronization controller to manage the synchronization and connect the links. This solution describes the function of one of these replication links. The other replication link behaves the same way, but in the opposite direction. To synchronize more than two copies of the replication set, create the appropriate replication link pair for each additional copy.

     Hint: When designing the replication link, it is important to know what types of conflicts can occur and how to handle them so that the integrity of replicated data remains intact. The design of conflict detection and conflict resolution is described in the Master-Master Replication pattern.


    enter image description here

    更多数据移动事件模式:

    Data Movement Patterns

    关于design-patterns - 两个相同关系数据库完全同步的设计模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21833128/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com