locked
Syncing using SnapShot CE RRS feed

  • Question

  • Hi,

    I have another question probably extension of the question asked in following thread:

    http://social.msdn.microsoft.com/Forums/en-US/syncdevdiscussions/thread/c4fde98d-2987-4d70-be53-0b3ee805a9a2

    Background is following:

    We sync CE database with SqlServer for 1st time and take snapshot of synced CE and give it to multiple clients to use, who again can sync with the same Sql server only.

    We have a bidirectional syncgroup and when we synced the CE first time, this group was synced and the data from SqlServer was populated in CE for it. Now when other clients use the snapshot of this CE, what we are observing is that when they intiate sync request on the same group, thousands of queries for insert/update/selectrow are being fired on SqlServer while there are no changes in both CE and SqlServer.

    My guess is that when a client syncs with SqlServer using the Snapshot CE, its data which came from SqlServer only, is detected as change because sync request is made by another client not the one who originally synced and created snapshot.

    Any idea why this is happening?

     

    Thanks

    Sumit 

    Friday, April 30, 2010 3:13 PM

All replies

  • did you just set the SynDirection to SyncDirection.Snapshot to generate the snapshot?

    If yes, in Snapshot, the client values for last received and last sent anchor values are not set.

    So when you change the SyncDirection to BiDirectional, the client will see that the last sent anchor is null and will result to the client uploading all of its rows.

    Since these rows are already in the server, you will get conflicts (thus you're seeing calls to SelectRow).

    Friday, April 30, 2010 4:21 PM
  • Thanks June,

    I take snapshot in following way. Before taking the snapshot I run the sync and the syncDirection there is set to default and SyncDirectionOrder is set to UploadAndDownload.

    SqlCeSyncStoreSnapshotInitialization syncStoreSnapshot = new SqlCeSyncStoreSnapshotInitialization();

    syncStoreSnapshot.GenerateSnapshot(LocalConnection,

    "BECSDB.sdf");

     

    after taking the snapshot the syncDirection is still default and SyncDirectionOrder is UploadAndDownload.

    So, there is no change in the direction before and after the snapshot. Only change is that Snapshot was taken by Client A and used by Client B.

    Can that be the problem?

    Thanks

    Sumit

    Friday, April 30, 2010 5:23 PM
  • got it. just got a bit confused since you mention syncgroup so i thought you're using the offline provider. how did you provision the client?

    when you generate the snapshot, there is a unique id associated to it to uniquely identify that copy in the collaboration/peer-to-peer scenario.

    the documentation says that if you distribute a snapshot and the first time it syncs, client-specific data is updated for that snapshot.

    I had however in the past encountered issues where the 2nd copy doesnt sync with the server after the first client synched.

    my thinking is if you copy the SDF, you now have duplicates of this id. you will run into problems when you sync since when you sync the first copy, the server records the id of that client that it has synched already, so when you run the 2nd copy, the server sync record says it already synced with it. So they may not sync correctly.

     

    Saturday, May 1, 2010 1:33 AM