The Operation Center schedules the database Mirroring Task, running it periodically for each customer and application instance.
This process will automatically set up change tracking on the SuperOffice CRM Online side, and create and update the schema of tables on the client-side. It will regenerate the mirror if it is thrown away or an older version is restored from backup.
Log Sequence Number (LSN) is a 64-bit integer assigned by SQL Server.
For each cycle, the following happens:
- Establish 2-way trust between the Mirroring Task (MT) and the client.
- For each table to be synchronized:
- The mirroring task enables change tracking for the table (if not already set).
- The mirroring task reads the physical schema and sends it to the client.
- The client responds with the Log Sequence Number if it has data for that table.
- The client updates its physical schema (including creating the table from scratch) as needed.
- For each chunk of changes (repeat until no more changes are found):
- The mirroring task reads the <chunksize> oldest changes from the table. If change tracking was not installed previously, or the client didn't have the table, all rows are considered changed.
- The mirroring task transmits the changes to the client. Each row includes its LSN.
- The client writes the data to the mirror and returns the LSN of the last successfully written row.
- After the last table has been synchronized, call the
ReplicationCompleted method to indicate that mirroring is complete for this customer.
Online customer databases don't keep state or progress indicator for mirroring, and there is no GUI for it either. By design, only the mirror knows the LSN for each table.
When does the mirroring task run?
The mirroring task is scheduled to run every 10 minutes. However, there are multiple tasks running in sequence on each customer tenant. If another task takes longer to complete than planned, the mirroring task might be delayed.
We also stop the task completely from 23.00 to 06:00 every night.
Mirroring does not run during server maintenance, such as SuperOffice CRM Online version upgrades.
One mirroring batch is equivalent to roughly up to 1 megabyte of data. The number of rows will vary widely depending on the actual size of the rows.
Each batch refers to 1 table, but 1 call to the IMirrorClientService interface may reference multiple tables using multiple batches.
The SuperOffice CRM Online server will limit the total call size by tracking content size.
Batches can in principle be processed in parallel, but doing so would probably saturate the IO channel of the target database server.