Replication: Non-convergence on Merge Replication

  • one possible cause...

  • I had worked on an issue which I found quite interesting so decided to post it in order to share with everyone.

  • Problem:

  • I change a row on the subscriber. Once that is done, I then see that the change is propagated to the publisher however the previous data on the publisher was sent down to subscriber. So subscriber has the old data, while publisher has new data that was changed on the subscriber. After a while (~1 min) the change is sent back down to subscriber and all is normal.

  • Environment:

  • 1 publisher

  • SQL Server 2005

  • Microsoft SQL Server 2005 - 9.00.3239.00 (Intel X86)

  • 1 subscriber

  • Microsoft SQL Server 2005 - 9.00.3239.00 (Intel X86)

  • Analysis:

  • Let me just explain the issue a bit more, as the problem description may not be so clear.

  • I have (example) a table on both publisher and subscriber with the following characteristics:

  • Name Modification Date ID File Size
  • Now in publisher and subscriber, the values are the same:

  • Test 29-April-2009 12:55 5 98
  • Now I change the value on the subscriber as such:

  • Test 29-April-2009 12:58 5 755
  • When I synchronized, I saw the following:

  • Publisher:

  • BEFORE: (original data)

  • Test 29-April-2009 12:55 5 98
  • AFTER: (sync and change on the subscriber)

  • Test 29-April-2009 12:58 5 755
  • Subscriber:

  • BEFORE: (changed done)

  • Test 29-April-2009 12:58 5 755
  • AFTER: (sync)

  • Test 29-April-2009 12:58 5 98
  • AFTER 1 MIN LATER: (sync)

  • Test 29-April-2009 12:58 5 755
  • For this issue, I got the verbose logging enabled (https://support.microsoft.com/kb/312292) and saw the following:

  • ...

  • [36%] Percent Complete: 36

    Downloaded 1 change(s) in 'table_name' (1 insert): 4 total

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [36%] Percent Complete: 36

    Downloaded 1 change(s) in 'table_name' (1 insert): 3 total

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [36%] Percent Complete: 36

    Downloaded 1 change(s) in 'table_name' (1 insert): 5 total

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [36%] Percent Complete: 36

    Waiting 60 second(s) before polling for further changes.

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [62%] Percent Complete: 62

    Waiting 60 second(s) before polling for further changes.

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [62%] Percent Complete: 62

    Uploading data changes to the Publisher

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [36%] Percent Complete: 36

    Downloading data changes to the Subscriber

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [36%] Percent Complete: 36

  • ...

  • Compared to a different verbose logging (or a merge replication that is not seeing this issue):

  • ...

  • Downloaded 2 change(s) in 'table_name' (2 inserts): 2 total

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [100%] Percent Complete: 100

    Downloaded 1 change(s) in 'table_name' (1 insert): 1 total

    OLE DB Distributor: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [100%] Percent Complete: 100

    Waiting 60 second(s) before polling for further changes.

    OLE DB Distributor: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [100%] Percent Complete: 100

    Uploading data changes to the Publisher

    OLE DB Distributor: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber: {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    Percent Complete: 100

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    No data needed to be merged.

    OLE DB Distributor 'table_name': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [100%] Percent Complete: 100

    Downloading data changes to the Subscriber

    OLE DB Distributor : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    OLE DB Subscriber : {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

    [100%] Percent Complete: 100

  • ...

  • From this, as well as the overall symptoms (problem description), we can see that this may be an issue of parallel upload/download. This can cause many issue behind the scenes.

  • We resolve this issue by first testing in a test environment the merge parameter

  • -ParallelUploadDownload 0.

  • -ParallelUploadDownload [0|1]

  • Specifies whether the Merge Agent should process in parallel the changes uploaded to the Publisher and those downloaded to the Subscriber, which is useful in high volume environments with high network bandwidth. If ParallelUploadDownload is 1, then parallel processing is enabled.

  • https://msdn.microsoft.com/en-us/library/ms147839.aspx

  • Once this was enabled, SQL Server no longer upload / downloaded in parallel and hence the issue no longer occurred.