1) Looking through the Sync Framework code I see that during upload the transactions are applied on a per-batch basis, that is, the client sends a batch of upload changes to the server, the server opens a new transaction for the batch, applies the changes
and then issues either a commit or a rollback depending on whether there were errors.
2) Also looking through the sync fw code I see that it opens a new DB connection for every batch.
Is this correct?
In practice what this means is that there is no transaction at the "session" level.
Many client devices will not have enough memory to create a single batch, though, so the client has to break up large uploads into smaller batches to avoid running out of memory.
So, if we are uploading changes to related tables to the server, such as a new invoice header record and the corresponding detail records, it is perfectly possible that the detail records may land in one batch and the invoice header record in another.
If there is a problem with one of the batches the bad batch will be rolled back, but the server database will be left in an incorrect state, and we have no way of rolling back the previous batches because there is no session-level transaction.
I would just like to have someone from MS confirm if the above is correct, so that we know how to approach implementing the sync fw for our products.