Step 5: Synchronize data in domains between sites

A domain center located on a master site operates as MDC (Master Domain Center) and has a direct connection to DomainDB - discussed in step 1. A domain center located at any other site operates in the SDC (Site Domain Center) role and caches data in a local object database. The MDC role stores data about all domains of the entire system and their entities, even if the domain is not maintained at the site according to the configuration file. The SDC role caches data only for those domains that are served on its site according to the configuration file. However, SDC owns the complete domain tree, and receiving requests to unattended domains proxies them to the sites serving them (SDC to SDC or SDC – MDC).

mdc sdcThe master domain is fully serviced only on the master site (as MDC). Servicing requests to the master domain in SDC differs from servicing requests to other unattended domains on the site - some requests are also proxied (on MDC), and some are processed locally. Accordingly, some settings and entities of the master domain are cached in the SDC for the needs of separate operation of the site without communication with the master site.

Since it is the domain center functionality that matters for all other parts of the system and the difference between MDC and SDC is indifferent, it is common to speak of the role of DC in those contexts where the difference between the two does not matter.

MDC on the master site via DomainDB is a backup repository of all domain settings and entities. At any time you can add another site to the configuration, bind domain zones to it, and the SDC on it will load all associated entities into its storage by synchronizing with the MDC.

Having a standalone DomainDB ensures that the system can be completely reinstalled with all domain settings and entities intact.

Data synchronization SDC – MDC

Whenever modifying CRUD operations on domain entities are performed on a domain-serving work site, the data first goes to the SDC, and then, if successful, is sent to the MDC, from where it goes to the domain’s DBMS_.

seq_sdc_mdc
Case: An administrator executes modifying CRUD requests by connecting to the WS of the master site while the domain is served at the work site.

For this purpose, there is a synchronization process initiated by each SDC. Just in this process, the accumulated outstanding changes are sent to MDC at the beginning, and only after that the full synchronization between SDC and MDC is done, where MDC is the source of information. Once every 20 seconds, each site performs a synchronization procedure between SDC and MDC MDC.

seq_mdc_sdc

Consequence: an administrator modifies an entity via WS of a work site, SDC accepts the changes and sends them to MDC, but it fails. In this case, the administrator sees that the entity has changed, and 20 seconds later the changes are rolled back, because MDC was the source of information during synchronization, and these changes are not there.

Communication SDC – SDC

SDC directly communicate with each other only in the framework of proxying requests from one site where the domain is not served to another where the domain is served. This is degenerate communication.

Multi-site domain service

Case: An administrator applies a configuration in which a domain is assigned to serve two sites. After some time, both sites work fully and holistically.

sdc mdc sdcA domain can be served on several work sites. The configuration file (step 1) is responsible for this configuration. Different roles exhibit different behavior patterns in connection with multisite domain service. Let’s look at how the SDC behaves in this situation. It turns out, all things considered - its behavior is a consequence of its synchronization process with MDC. Whenever one of the sites in the SDC changes some entity. some entity, that change is first pushed to the MDC and then then from there it is synchronized to the other SDCs (see figure). In this case conflicts are also solved by MDC and its transactionality: creation of an item with the same identifier from different sites - remains the one who first ran to MDC, when changing one entity - remains the one who last ran to MDC, deletion is indifferent to the sequence, but has priority over modification of an entity in any order of operations. Obviously, it is impossible to get an infinite cycle of synchronization of several sites. It is worth keeping in mind that synchronization of domain entities between the two sites occurs in intervals of 20 seconds. That is, mostly sites will be synchronized within 20 seconds. In some rare cases synchronization time may increase several times.

Case: An administrator applies a configuration in which a domain zone with three levels of domains is mapped to a new site. For each interval of 20 seconds one level of domains of the migrated zone will be synchronized - first the first level of domains will be synchronized, among its entities there are child domains and they will be activated, after 20 seconds they will be synchronized and will pass the baton to the domains of the 3rd level of the zone.
sync_domain_levels

A working site with no connection to others

Case: an administrator makes a modifying CRUD request to the WS of a working site under conditions where the MDC is unavailable (perhaps no connection to the master site, or something else).

In this case for the administrator everything looks the same as in step 1. And internally, the changes are applied to the current site, and stored in the submit queue. SDC makes periodic attempts to send them exactly in the sequence in which they were applied. There is a limit of 10000 modifying CRUD_requests per site on the size of this queue, after which _SDC starts refusing to execute them.

seq_sdc_mdc_fail
Case: two administrators on two sites change the same entity in an environment where one site cannot access the master site.

As a verification exercise, try to describe the steps of the process yourself up to the end of synchronization and find out the states of the entity being changed at these sites at each step.

Table 1. Terms used
term Determination

MDC

!

SDC

!

DC

!

Object database

!

Proxying a request to another site

!

Multi-site domain service

!