none
Sync tool - fatal bug - appreciate your help RRS feed

  • Question

  • Here’s what we did,
    1) We have a cloud database and an in-house database.  We setup a “Sync” agent between the Cloud and the in-house.
    2) The data synchronizes back and forth pretty nicely except in one scenario.
    3) Let’s say we have a database "On Insert" trigger on one of the tables that “adds” 3 to a numeric field [Col=Col+3].  If I entered a value of 1, the cloud database gets updated as 4 [which is expected], but when the sync is complete, my local database has a value of 7 [double counted]
    4) Note: I run the command line version of the “Sync” that I copied from the “Agent Script”. 
    Thursday, July 8, 2010 5:31 PM

All replies

  • Hi there,

    This doesn't sound like a bug in the Sync tool, presuming that On Insert trigger is on both dbs.  When you sync the column across it will get inserted and your On Insert trigger is going to run again.  There is no real support for this in the Sync Framework.  You can try various hack solutions like modifying the sync insert stored procedure to "minus 3" or perhaps tap into the Sync Framework apply events and modify the columns in the dataset to minus 3 there.  Or you could disable the trigger during a sync if that is feasible.

     

    -Jesse

    Friday, July 9, 2010 12:14 AM
  • Thanks Jesse, based on what I read here https://www.microsoft.com/windowsazure/developers/sqlazure/datasync/ I was hoping that this scenario should be handled by the tool.

    In any case, what is the best way to keep my Cloud Database and In-premise database in "Sync".  We are migrating our apps to Azure and we'd like to backup our SQL Azure data.  So, we are setting up a sync between our in-premise database and our cloud database and we backup our in-premise database every 4 hours.

    -Thanks again

    Friday, July 9, 2010 11:41 AM
  • Your general scenario (syncing sql azure to on premise) is handled by the tool, however the specific trigger issue is not something that is supported by the Sync Framework database providers.  You'd have to implement some sort of workaround.

    -Jesse

    Tuesday, July 13, 2010 12:16 AM