davidpricedev
davidpricedev

Reputation: 2237

Is there a way to manually update the tracking tables to jumpstart a sync?

I am using the Microsoft Sync Framework "collaboration" providers. Both ends of the sync will use SQL Express to begin with. When provisioned the database contains a "_tracking" table for each "real" table in the database. My database is fairly large, and I don't want to transfer the entire thing via MSF on the first sync. Is there a way to use some other method to "jumpstart" the sync when both sides are known to contain the same data? In my testing when both databases contain identical content, it looks like it downloads the entire scope, churns through the entire batch of "changes", and then uploads the entire scope back to the server which then churns through the entire dataset again. Is there any way to update the _tracking tables (hopefully only on one side) to let the system know that the database contents are the same?

More information (edit):

From examining the contents of the tracking tables after doing an initial sync, it looks like the scope_update_peer_timestamp and local_create_peer_timestamp fields in every _tracking table need to be updated on both sides. In addition, the update_scope_local_id, scope_update_peer_key, and last_change_datetime need to be set on one of the two sides.

The last_change_datetime field is a datetime and is fairly self-explanatory. The two _timestamp fields seem to use @@DBTS and are thus bigints that contain the equivalent of an editable timestamp column.

That still leaves a bunch of unknowns:

More information on the environment (edit):

I have SQL Express/Std on both sides. The server side will eventually contain information for several clients (using multi-tenancy), so backups will not be useful since the server will contain information for multiple clients.

Upvotes: 0

Views: 1028

Answers (1)

JuneT
JuneT

Reputation: 7860

how are you initializing your databases? are you provisioning databases that both contain the same set of data already?

the best way to initialize other replicas is to use the GenerateSnapshot method on the SqlCeSyncProvider that creates an SDF file to initialize other replicas or to do a back up of the database (non-SDF, SQL Server/Express database), restore it and run PerformPostRestoreFixup before doing a sync.

Upvotes: 1

Related Questions