locked
How to handle changes in the underlying data store during sync process RRS feed

  • Question

  • Hi!

    We have a source database (SQL CE) that is regularly changed by a service. The data in the SQL CE data store should be sync'ed to a central SQL Server (SQL Azure). We are facing severe problems whenever the source database changes during sync. Think of the following example:

    1. Lets assume both databases are empty (client version = 0, server version = 0)

    2. A record is added to the client DB (version of the new record = 1, new client version = 1)

    3. Sync starts
        The sync process has to sync multiple tables, therefore it determines the current version of the DB (=1). The goal is to iterate over all tables, find all changes between the last sent anchor (0 because never sync'ed before) and the current version of the DB (=1).

    5. Previously added record is changed (creation version remains 1, last update version = 2)

    6. The sync process gets to our table and looks for records with last update version between last sent anchor (=0) and DB version from step 4 (=1)
    ==> Problem: Our record does not fall into this range because it has changed since the start of the sync. You could argue that that is not a big problem because the record will be transfered during the next sync process. In fact it is a BIG problem because
      a) other tables in the DB could have a reference to this record as it has been created earlier
      b) If we transfer the record in the next sync, sync framework complains because creation version would be in knowledge of the target DB although the record is not there

    Another option for step 6 would be to take all records with last update version between last sent anchor (=0) and DB version from step 4 (=1) OR(!) creation version (=1) between last sent (=0) anchor and DB version from step 4 (=1).
    ==> Problem: Sync framework complains because last update version of the row is not within the knowledge that is transferred in the current sync batch.

    My questions are:
    1. How to handle situations with data changes that happen during sync in general?
    2. Does anyone now how ADO.NET Sync Services handle such situations?

    Thank you in advance for your help!
    Kind regards,
    Rainer.


    Rainer
    • Moved by Mahesh DudgikarMicrosoft employee Tuesday, December 22, 2009 7:07 AM (From:SyncFx - General)
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:23 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, December 9, 2009 5:31 PM