Answered by:
Error in batch sync in collaborative scenario

Question
-
I've created a provider in a sql to sql sync using DbSyncProvider and enabling batches.
During the changing enumeration often occurs an error, connection timeout in some ciructances of low bandwith connection or general connection errors.
Reading the sync documentation in the "Deliver changes in batch (Sql Server) - Understanding batches", I find the following:
- Enables Sync Framework to restart a failed synchronization operation from the start of the current batch,
rather than the start of the entire set of changes.
- Can reduce or eliminate the need to re-download changes or re-enumerate changes on the server due to failed operations.
BTW, how can I handle such errors, achieve the result as sayd in the documentation and restart the batch enumeration witout loosing all, by now I need to restart the entire sync when I get the connection error.
Thanks, Piero- Moved by Liam Cavanagh - MSFTMicrosoft employee Sunday, January 24, 2010 6:05 PM (From:SyncFx - Microsoft Sync Framework Database Providers)
Sunday, January 24, 2010 2:07 PM
Answers
-
Hi Piero,
The restart feature is an inherent runtime feature and needs no explicit action from the user. The restart/reuse works like this.
During enumeration the source provider checks to see if it has unused batches from an earlier incomplete sync. If it does then it checks to see if it can reuse them. For batch files to be reuse the batches must be complete (enumeration must have completed and all batches from 1 to end are available) is available and the destination knowledge doesnt contain the changes in the batches. If the destination got changes from another peer then sending the same changes will be useless as the destination already knows about them. Then it basically reads metadata from the last batch to get a list of table watermarks and then restarts enumeration from that point onwards. This is from the runtime prespective. The runtime does not reenumerate the SQL server changes again.
If your app is two tier (i.e both the source and destination provider are on the same box) there is absolutely nothing you need to do here. However if your app is split to multiple tiers then you need to ensure that you down download the same batch file twice. Please refer to the WebSharingAppDemo-CEEndToEnd SDK sample to see how the proxy handles the case where the remote tier already has the file.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar- Proposed as answer by mjayaram Tuesday, January 26, 2010 12:14 AM
- Marked as answer by Liam Cavanagh - MSFTMicrosoft employee Thursday, January 28, 2010 5:21 PM
Tuesday, January 26, 2010 12:14 AM
All replies
-
Hi Piero,
The restart feature is an inherent runtime feature and needs no explicit action from the user. The restart/reuse works like this.
During enumeration the source provider checks to see if it has unused batches from an earlier incomplete sync. If it does then it checks to see if it can reuse them. For batch files to be reuse the batches must be complete (enumeration must have completed and all batches from 1 to end are available) is available and the destination knowledge doesnt contain the changes in the batches. If the destination got changes from another peer then sending the same changes will be useless as the destination already knows about them. Then it basically reads metadata from the last batch to get a list of table watermarks and then restarts enumeration from that point onwards. This is from the runtime prespective. The runtime does not reenumerate the SQL server changes again.
If your app is two tier (i.e both the source and destination provider are on the same box) there is absolutely nothing you need to do here. However if your app is split to multiple tiers then you need to ensure that you down download the same batch file twice. Please refer to the WebSharingAppDemo-CEEndToEnd SDK sample to see how the proxy handles the case where the remote tier already has the file.
Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar- Proposed as answer by mjayaram Tuesday, January 26, 2010 12:14 AM
- Marked as answer by Liam Cavanagh - MSFTMicrosoft employee Thursday, January 28, 2010 5:21 PM
Tuesday, January 26, 2010 12:14 AM -
Hi Maheshwar,
Yes my application by now is two tier and now I'm planning to migrate to a 3-tier architecture. I've now understand how the batch reuse is going to working but I've found no answer to the problem I was writing for:
"During the changing enumeration often occurs an error, connection timeout in some ciructances of low bandwith connection or general connection errors. "
I was thinking that when a connection error occurs using a batched aproach (ora maybe if using a non batched aproach also) the runtime could handle the enumeration command error and restart the command execution (if in a single batch the specific batch enumeration to be repeated). Instead of repeating the enumeration the application fails.
Simply speaking I'm not able to understand how handle an enumeration fail (due to sql cmd timeouts or connection), by now when an exception for timeout occurs the entire sync process is to be restarted.
Thanks
PieroMonday, February 1, 2010 9:22 AM