none
Data conflict resolution as last writer wins RRS feed

  • Question

  • There is options to handle data conflict as source or destination win. How can do last change win for conflicts during the "sql server database" synchronization. tracking table holds latest_change_time but, to read tracking table do i have to make query on tracking table ? DataConflict event(ApplyChangeFailed) gives me timestamp value and how can apply last writer wins ?
    • Edited by sk0601 Friday, March 2, 2012 8:32 AM
    Thursday, March 1, 2012 9:57 AM

Answers

  • I have an UpdateTime column in any table that has the possibility of multiple people updating. ... and look at that field when conflicts occur.  I also make sure each computer's Time is in sync with each other... 
    • Marked as answer by sk0601 Monday, March 12, 2012 7:54 AM
    Thursday, March 8, 2012 2:23 PM
  • unfortunately, afaik, only the metadata cleanup codes actually include that column in their queries. the normal sync codes dont.

    the rows that you have in the conflict in the event handler is actually the row from the source and sync fx grabs the local conflicting row by executing the selectrow sp. both selectchanges and selectrow stored procedure excludes the updatetime column.

    you can try adding the column in these stored procs, but i think that is more work than adding a column for update datetime and simply including that column in the sync. 

    Racing_Prog's alternative is one option you can explore.


    • Edited by JuneTModerator Thursday, March 8, 2012 4:27 PM
    • Marked as answer by sk0601 Monday, March 12, 2012 7:54 AM
    Thursday, March 8, 2012 4:12 PM
    Moderator

All replies

  • Is not there any solution in sync framework ? For this condition, i have to get last_change_time of tracking table and to do this, in the ApplyChangeFailed event i need a query to sql server database... I think it should not be best practise ...
    Friday, March 2, 2012 8:35 AM
  • afaik, the last_change_datetime columns is only used  by the metadata cleanup functions. so you will have to query it if you want to use it for conflict resolution.
    Monday, March 5, 2012 12:39 PM
    Moderator
  • last_change_datetime column reflects needed time value whenever base row changes. There is no obligation to use this column. My purpose is to compare time values of changes on local and remote data rows when conflict occurs. In our system, we just downloading data from remote site. If i query a second time to remote site, it decreases reliability of our system. After downloading data, if any connection problem occurs between sites i cant reach to needed time value in this design. That is the why i dont want to implement this design.

    Is it possible to customize DbApplyChangeFailedEventArgs to reach datetime value instead of timestamp column of tracking table ?

    Thursday, March 8, 2012 1:31 PM
  • I have an UpdateTime column in any table that has the possibility of multiple people updating. ... and look at that field when conflicts occur.  I also make sure each computer's Time is in sync with each other... 
    • Marked as answer by sk0601 Monday, March 12, 2012 7:54 AM
    Thursday, March 8, 2012 2:23 PM
  • unfortunately, afaik, only the metadata cleanup codes actually include that column in their queries. the normal sync codes dont.

    the rows that you have in the conflict in the event handler is actually the row from the source and sync fx grabs the local conflicting row by executing the selectrow sp. both selectchanges and selectrow stored procedure excludes the updatetime column.

    you can try adding the column in these stored procs, but i think that is more work than adding a column for update datetime and simply including that column in the sync. 

    Racing_Prog's alternative is one option you can explore.


    • Edited by JuneTModerator Thursday, March 8, 2012 4:27 PM
    • Marked as answer by sk0601 Monday, March 12, 2012 7:54 AM
    Thursday, March 8, 2012 4:12 PM
    Moderator
  • Thanks for your interest. In our system there is millions of table created and now it is hard to interfere data model. Most probably i will try to change stored procedures.
    Monday, March 12, 2012 7:54 AM