locked
Database Synchronization - Disconnect the computer from network while synchronizing RRS feed

  • Question

  • Hi All,

    I am testing database synchronization with Sync framework. For an example let's take the following scenario. I have my server database and the client database on two separate computers. While the synchronization is in progress, I am removing the server from the network, but still I can see the synchronization in progress.

    Then the synchronization gets completed, but when I check the client database, it is empty. When I run the synchronization again, no changes are downloaded, it says two databases are up to update.

    My question is how to handle such situations with Sync framework.

    Appreciate your help.

    Thanks.

    Happy Coding.

    Regards,

    Jaliya


    Jaliya Udagedara(MCPD) http://www.jaliyaudagedara.blogspot.com

    Monday, February 11, 2013 7:37 AM

Answers

  • that should have fired an exception. assuming a download scenario, there is no way its going to be able to retrieve the changes if the remote database is disconnected. when did you pull the plug to disconnect?

    when you do your test, i suggest you enable sync framework tracing to see a detailed log of what's happening.

    Monday, February 11, 2013 11:46 AM
  • am not sure about sync stopping when disconnected and restarting again. there are timeouts for connection and commands, am guessing if you unplug and plug again before it timeouts, then that's what you may be seeing.

    the timing of when you unplug or disconnect has a bearing on whether you get an error or not. if you start a sync and wait some time before disconnecting, there's a chance that the sync provider has already got what it needs from the source before you unplug.

    afaik, the DbConnectionFailure gets fired on change application.

    you're doing a download, your remote provider is the source. the change application is happening on your local provider.

    to give you an idea of the sync process/stages, you can enable sync framework tracing in verbose mode and you should be able to see what's happening under the hood.


    • Edited by JuneT Monday, February 11, 2013 12:29 PM
    • Marked as answer by Jaliya UdagedaraMVP Monday, February 11, 2013 1:04 PM
    Monday, February 11, 2013 12:26 PM
  • Command Timeouts are separate from Connection timeouts.

    if it's establishing connection, that's connection timeout kicking in. 

    if its executing command and waiting to complete, that's command timeout.

    Monday, February 11, 2013 1:01 PM

All replies

  • that should have fired an exception. assuming a download scenario, there is no way its going to be able to retrieve the changes if the remote database is disconnected. when did you pull the plug to disconnect?

    when you do your test, i suggest you enable sync framework tracing to see a detailed log of what's happening.

    Monday, February 11, 2013 11:46 AM
  • Hi JuneT,

    Actually I really find it difficult understanding the mechanism behind the database sync. First I had both server and client databases running on separate machines. And the program was running inside my machine. Once I disconnected my compute from network, the sync stopped and once I plugged the cable back, sync started again.

    Next scenario the server database was in my machine and the client was in another. Once sync is started and after couple of seconds, I have disconnected my machine from network. But still sync was in progress.

    Then just after sync is started, I have disconnected my machine from network. Then the program threw me an error. In here I am trying to download items from my remote provider which is my client. The funny thing is why is that "remoteProvider.DbConnectionFailure" never get fired?

    Appreciate your help JuneT.


    Jaliya Udagedara(MCPD) http://www.jaliyaudagedara.blogspot.com


    Monday, February 11, 2013 12:13 PM
  • am not sure about sync stopping when disconnected and restarting again. there are timeouts for connection and commands, am guessing if you unplug and plug again before it timeouts, then that's what you may be seeing.

    the timing of when you unplug or disconnect has a bearing on whether you get an error or not. if you start a sync and wait some time before disconnecting, there's a chance that the sync provider has already got what it needs from the source before you unplug.

    afaik, the DbConnectionFailure gets fired on change application.

    you're doing a download, your remote provider is the source. the change application is happening on your local provider.

    to give you an idea of the sync process/stages, you can enable sync framework tracing in verbose mode and you should be able to see what's happening under the hood.


    • Edited by JuneT Monday, February 11, 2013 12:29 PM
    • Marked as answer by Jaliya UdagedaraMVP Monday, February 11, 2013 1:04 PM
    Monday, February 11, 2013 12:26 PM
  • Hi JuntT,

    Thank you so much for pointing out tracing. Now I guess I am on a track. Yeah, remoteProvider.DbConnectionFailure is not triggering since I am doing the downloading.

    Finally I checked the log.

    This is how it is happening (correct me If I am wrong please).

    Until Local DB started Applying Changes, if I disconnect my PC from the network I am throwing with an error. Because till that remote provider is making changes. Once the Local DB started Applying Changes, I can disconnect my network, because after that changes are happening to local db.

    Another Question JuneT, let's say before Local DB started Applying Changes, I have disconnected my PC from the network. That means I have no access to remote provider. I am getting an error ,right?. What I want to do now is, I want to increase the timeout value here. I have tried setting both,

     localProvider.CommandTimeout = 10000;
     remoteProvider.CommandTimeout = 10000;

    but no luck. Within like 5 seconds I getting the error. Any idea on this.

    I really appreciate your help. 


    Jaliya Udagedara(MCPD) http://www.jaliyaudagedara.blogspot.com



    Monday, February 11, 2013 12:51 PM
  • Command Timeouts are separate from Connection timeouts.

    if it's establishing connection, that's connection timeout kicking in. 

    if its executing command and waiting to complete, that's command timeout.

    Monday, February 11, 2013 1:01 PM
  • Hi JuneT,

    Great, Thank you so much for the valuable information. I hope I can catch you up again for more advise and infor.

    Thanks.

    Happy Coding.

    Regards,

    Jaliya


    Jaliya Udagedara(MCPD) http://www.jaliyaudagedara.blogspot.com

    Monday, February 11, 2013 1:04 PM