locked
Transaction support in MSF RRS feed

  • Question

  • Hello everyone!

    I have a simple newbie question - does MSF executes it's synchronizations in transaction way? What will happen if connection drops in the middle of database sync? And what about file sync?

    In MSDN I found only information about merge conflicts, but nothing about low-layer network connectivity problems and MSF behavior during such events?

     

    So, I rephrase the question - can MSF rollback everything changed during sync session if it was interrupted because of network disconnect?

     

    And the second question as a continuation of the first - can MSF perform several synchronizations in one transaction? For example - I want to sync database that holds references to files on filesystem, and after that I want to sync files themselves. And both syncs must be executed in single transaction, to avoid inconsistent state of data.

    Friday, December 10, 2010 11:48 AM

Answers

  • If you are using database sync, transaction will be enabled. In general, all of sync change application will be in same transaction unless you use some of newer V2.1 features. So if the network dies when you are syncing, all changes will be rolled back.

    File sync doesn't have transaction for the complexity to support transaction for file system. However, file sync provider tries to maintain the consistency of synced data and metadata so that if there is interruption in sync, later sync will handle them correctly.

    Tuesday, December 21, 2010 6:02 PM
    Answerer

All replies

  • 20 views and not a one reply. I can't believe that noone knows a simple answer to my question.

    Actually, there are only two answers:

    1) Yes, MSF performs sync in one big transaction

    2) No, transactions are not supported, if sync session fails, data stays in partially synced state.

     

    Which answer is correct one?

    Friday, December 10, 2010 4:40 PM
  • no you can't combine database sync and file sync in one transaction... they're using different providers and different sync sessions as well.

    as far as database providers is concerned, while you can enable batching, the batching is only for uploading/downloading the changes, all the changes are still applied in a single transaction.

    Monday, December 13, 2010 3:34 PM
  • Thank you for your answer. I'm still amazed that I could not find any information about transaction model in the official documentation.

     

    Anyway, I have to be able to do DB and file system changes in one transaction, so it looks like I'll have to implement custom aggregation provider.

    Wednesday, December 15, 2010 12:06 PM
  • He-he, I've found word "transaction" in the official docs, look here:

    "All Customer table changes are applied to the client database in a single transaction (if batching is not used), followed by OrderHeader changes that are applied in a second transaction."

    Quote was taken from this article: How to: Specify the Order and Batch Size of Changes .

    From this quote I understand that there is no transaction after all! Each table is updated in separate transaction so it is possible to leave database in broken state! Also it seems that you are wrong about batching.

    Am i right or not? Or is this article obsolete (because it is about MSF 2.0)?

    Wednesday, December 15, 2010 12:50 PM
  • If you are using database sync, transaction will be enabled. In general, all of sync change application will be in same transaction unless you use some of newer V2.1 features. So if the network dies when you are syncing, all changes will be rolled back.

    File sync doesn't have transaction for the complexity to support transaction for file system. However, file sync provider tries to maintain the consistency of synced data and metadata so that if there is interruption in sync, later sync will handle them correctly.

    Tuesday, December 21, 2010 6:02 PM
    Answerer