Changes are not coming on Client RRS feed

  • Question

  • Hi,

    We are using BCP to take backup of database on Server and importing the data using Sync Framework on Client.

    but data is not updated on the client, which is added/updated after BCP run (once the backup files are created) and before Sync/provisioned on Client.

    for example: Admin creates backup files on monday and then modify the data on Tuesday.

    now then Client Sync the database on Wednesday..... so the data changes done  on Tuesday are not updated on Client.

    Even in the next Sync also it is not fetching those updates while all other updates done after 1st Sync are coming.

    Framework is looking for the updates done after Sync instead of time when Backup is done.

    Is there any way to set timestamp of Server when files are backup or any other solution?


    Thursday, September 16, 2010 12:31 PM

All replies

  • are you trying to initialize your client database from BCP and then synchronising the client to the server where the original BCP content came from?

    Sync Fx has no idea of the back up time. It maintains the metadata at the row level and maintains another set of metadata to indicate it's knowledge of the data in the sync scope and this metadata is updated when the scope is provisioned on the client with existing data.

    when you populate the client with data from BCP and then provisioning it, the client will populate its own metadata with the data from BCP.  when you sync the first time, this will actually raise conflicts as the metadata for the scope will be different for the client and the server and will most likely cause the server to send rows down that are already existing in the client thus causing conflicts whihc would prevent the application of changes. try subscribing to the ApplyChangesFailed event to verify this.

    Sync Fx looking for updates done after the first Sync is just a normal behaviour.

    Thursday, September 16, 2010 2:23 PM
  • Thanks for reply JuneT

    Let me explain the issue in details because i think we are already doing the same what you suggested.

    We run BCP to take backup on Server and then we configure Client.

    Client calls a service that downloads the data files and then downloads DB schema and created the database on the client. 

    We use sync fx service to create the tables which will also create the tracking tables and SPs on the client database

    BCP imports the data for each table. Once the data is imported successfully we update the Scope_info table on the client by running a fake Sync.


    Fake Sync - we run a Sync which gets the data from the server, Since it fetches all records we clear the dataset, this is only to update scope info with scope Knowledge.

    If we don't run fake Sync, then it fetches the complete data instead of Incremental Changes in next Sync (in First incremental Sync)

    Is there any work around?

    Friday, September 17, 2010 9:30 AM
  • not that am aware of. when you clear the dataset on first sync, Sync Fx updates the scope knowledge thinking that it was able to apply the changes. So the knowledge is updated, but the actual incremental changes after the backup are not. So unless these rows are updated from the source, the comparison of the knowledge from source and destination will show that the destination already has the data.

    i still suggest you use the SQL CE database generated using GenerateSnapshot to initialize your client. The snapshot would have its knowledge up to date and when you first sync, Sync Fx will not send down the rows that are part of that knowledge.

    others had success doing a database backup, restoring on client and doing Post restore fix up.

    Friday, September 17, 2010 2:32 PM
  • Thank you June.


    I tried using PerformPostRestoreFixup() but was not able to get the incremental changes, instead it is pulling the data from the scratch.


    The steps which we are following are as follows


    1. Create database

    2. Create table schema using the sync service which will in turn createa all the sync related tables.

    3. Import the data for each table.

    4. Update scope_info table

    5. Synchronize the scope i.e the fake synch

    6. call PerformPostRestoreFixup()  method.


    If I exclude step 4,5 then all the data are being pulled down to client from the scratch.


    After the first synch any incremental changes are brought down to the client successfully.


    We can try the snapshot feature but here there are multiple clients with database of more than 10GB size, which will again be a problem if multiple clients are trying to Sync.


    Is there any other way to update the server with the time stamp/ knowledge from the client to pull the incremental changes?

    Monday, September 20, 2010 11:02 AM
  • as i have previously mentioned in your other thread, the SqlSyncProvider is not based on anchors that serves as markers that marks where to start the sync.

    am not sure about the approach of updating the the scope_info table directly.

    the PerformPostRestoreFixup is used with a restored backup.

    is there a filter for the data that goes to each client or each client gets the same set of data?

    Monday, September 20, 2010 2:05 PM