none
Do I need to ensure that 2 users do not sync at the same time? RRS feed

  • Question

  • My app uses SQL Server 2008 and SQL Server CE SP1 on the client.  I have recently seperted the server providor into a sevice which runs on the SQL Server machine.  The client connects to it, using a tcp connection using wcf.  Do I need to have a locking mechanism to ensure that 2 users do not sync at the same time?

    Also I was thinking of riting the last anchor for each client inot a table at the server at the end of each sync session.   This would allow me to know ,from the server, when the last time each client sync'ed and which data they have.  Any thoughts?

    Friday, July 2, 2010 1:46 PM

All replies

  • will the clients be updating the same set of data?

    as for saving the anchor values, you can try saving them to a local table and simply including the table as part of the sync upload:)

    Monday, July 5, 2010 8:46 AM
    Moderator
  • All users use the same tables and there is the possibility of conflict (which I deal with during sync) but the design attempts to minimize it.  I am concerned with how the sync would handle the data changing during a sync because of a simultaneous sync with another user.  For now I created a lock semaphore (BeginSync and EndSync) which prevents 2 users from syn'ing at the same time.  However, this is more than trivial as I must monitor for a dropped connection and clear the semaphore so the server does not remain locked.

    I don't think using a client table will work. The server anchor values are updated at the end of the sync process so this table would reuqire another sync. It is easy enough to write the value to a table at the server directly.

    Tuesday, July 6, 2010 3:29 PM
  • it makes sense, just like any other database applications, Sync Fx is not exempted from issues on lock contention, timeouts, deadlocks etc...
    Wednesday, July 7, 2010 11:17 AM
    Moderator