The database Mirroring Task
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.
- The mirroring task reads the
After the last table has been synchronized, call the
ReplicationCompletedmethod 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 20 minutes. However, multiple tasks run 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.
Customers can add custom user preferences to control database mirroring behaviors.
|Preference Name||Preference description||Default value|
|BatchSize||Used to control how many bytes to send per request.||1000000|
|SkipTable||Comma seperated list of tables that should not be mirrored.|
See the Skip Tables section to understand how to add the Mirroring prefences into SuperOffice.
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.