Microsoft KB Archive/828637

= FIX: Users Can Control the Compensating Change Process in Merge Replication =

Article ID: 828637

Article Last Modified on 11/2/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 2000 Enterprise Edition
 * Microsoft SQL Server 2000 Personal Edition
 * Microsoft SQL Server 2000 Enterprise Edition
 * Microsoft SQL Server 2000 Workgroup Edition
 * Microsoft SQL Server 2000 Desktop Engine (Windows)
 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 Enterprise Edition 64-bit

-





SYMPTOMS
When you use merge replication, the Merge Agent may experience synchronization errors if an insert change, an update change, or a delete change cannot be applied at a destination replica for various reasons, including a primary key violation at the publisher or at the subscriber. The Merge Agent always sends a compensating change to the source replica to undo the failed change. The Merge Agent executes the compensating change process to make sure that data is maintained in a consistent and convergent state at all replicas. Without the compensating changes, data may vary between replicas if an error such as a primary key violation occurs. If the data varies across replicas, non-convergence of data occurs.

Before this hotfix, there was no way to permit users to control the compensating change process. The compensating change process was handled internally by the Merge Agent. Because this process was handled internally by the Merge Agent, it was difficult to troubleshoot why certain conflicts occurred. Also, because the conflicting row is deleted from or undone in all the replicas, the row data is removed from the whole topology. To help troubleshoot these issues, Microsoft has added a new article-level property to merge replication that permits users to control the compensating change process.



Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 How to obtain the latest SQL Server 2000 service pack

Hotfix information
The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date         Time   Version            Size    File name --  31-May-2003  18:45  2000.80.818.0      78,400  Console.exe 25-Jun-2003 01:01  2000.80.818.0      33,340  Dbmslpcn.dll 25-Apr-2003 02:12                    786,432  Distmdl.ldf 25-Apr-2003 02:12                  2,359,296  Distmdl.mdf 30-Jan-2003 01:55                        180  Drop_repl_hotfix.sql 26-Aug-2003 20:16  2000.80.854.0     528,960  Dtspump.dll 23-Jun-2003 22:40  2000.80.837.0   1,557,052  Dtsui.dll 23-Jun-2003 22:40  2000.80.837.0     639,552  Dtswiz.dll 24-Apr-2003 02:51                    747,927  Instdist.sql 03-May-2003 01:56                      1,581  Inst_repl_hotfix.sql 08-Feb-2003 06:40  2000.80.765.0      90,692  Msgprox.dll 01-Apr-2003 02:07                      1,873  Odsole.sql 05-Apr-2003 01:46  2000.80.800.0      62,024  Odsole70.dll 07-May-2003 20:41  2000.80.819.0      25,144  Opends60.dll 02-Apr-2003 21:48  2000.80.796.0      57,904  Osql.exe 02-Apr-2003 23:15  2000.80.797.0     279,104  Pfutil80.dll 04-Aug-2003 18:17                    550,780  Procsyst.sql 22-May-2003 22:57                     19,195  Qfe469571.sql 06-Sep-2003 01:36                  1,090,932  Replmerg.sql 06-Sep-2003 07:18  2000.80.858.0     221,768  Replprov.dll 06-Sep-2003 07:18  2000.80.858.0     307,784  Replrec.dll 06-Sep-2003 00:00                  1,087,150  Replsys.sql 13-Aug-2003 16:28                    986,603  Repltran.sql 29-Jul-2003 20:13  2000.80.819.0     492,096  Semobj.dll 31-May-2003 18:27  2000.80.818.0     172,032  Semobj.rll 05-Aug-2003 21:06                    127,884  Sp3_serv_uni.sql 01-Jun-2003 01:01  2000.80.818.0   4,215,360  Sqldmo.dll 07-Apr-2003 17:44                     25,172  Sqldumper.exe 19-Mar-2003 18:20  2000.80.789.0      28,672  Sqlevn70.rll 02-Jul-2003 00:18  2000.80.834.0     180,736  Sqlmap70.dll 03-Sep-2003 02:56  2000.80.857.0     188,992  Sqlmmc.dll 02-Sep-2003 23:03  2000.80.857.0     479,232  Sqlmmc.rll 08-Feb-2003 06:40  2000.80.765.0      57,920  Sqlrepss.dll 06-Sep-2003 07:19  2000.80.858.0   7,598,161  Sqlservr.exe 25-Jul-2003 21:44  2000.80.845.0     590,396  Sqlsort.dll 08-Feb-2003 06:40  2000.80.765.0      45,644  Sqlvdi.dll 25-Jun-2003 01:01  2000.80.818.0      33,340  Ssmslpcn.dll 01-Jun-2003 01:01  2000.80.818.0      82,492  Ssnetlib.dll 01-Jun-2003 01:01  2000.80.818.0      25,148  Ssnmpn70.dll 01-Jun-2003 01:01  2000.80.818.0     158,240  Svrnetcn.dll 31-May-2003 18:59  2000.80.818.0      76,416  Svrnetcn.exe 30-Apr-2003 23:52  2000.80.816.0      45,132  Ums.dll 02-Jul-2003 00:19  2000.80.834.0      98,816  Xpweb70.dll Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.



MORE INFORMATION
This hotfix adds a new article-level compensate_for_errors property for merge publications. You can set this property to true or false. The default value for this property is true. The default setting means that merge replication continues to issue compensating changes as it has in all previous releases and service packs. When this property is set to true and an insert change, an update change, or a delete change cannot be applied at a destination replica for various reasons (a primary key violation occurs at either the publisher or the subscriber, for example), the Merge Agent sends a compensating change to the source replica to undo the change.

When the compensate_for_errors property is set to false and a change cannot be applied at a destination replica, compensating actions are not issued and the failed change remains as a conflict until the database administrator resolves the error condition. The Merge Agent tries to replicate the row on each subsequent synchronization run until the error condition is resolved.

Downlevel subscription agents, particularly pull subscribers that do not have this hotfix installed, continue to behave as though the compensate_for_errors property is set to true, even if you have installed this hotfix on the publisher and the compensate_for_errors property is set to false on the publisher. Therefore, users should upgrade all subscribers to this hotfix if they want to use the functionality that is provided by the new compensate_for_errors property. This upgrade helps to ensure consistent behavior across the topology.

For Microsoft SQL Server 2000 Windows CE Edition subscribers, download conflicts behave the same as in all previous SQL Server releases, regardless of the compensate_for_errors property setting. However, the setting of the compensate_for_errors property determines whether compensating changes are generated during the upload of errors and conflicts from SQL Server CE subscribers to a SQL Server publisher (when both the publisher and the computer that is running Microsoft Internet Information Services (IIS) have been upgraded to this hotfix).

This property is exposed in both the sp_addmergearticle stored procedure and the sp_changemergearticle stored procedure as a new parameter named @compensate_for_errors. This property is not exposed in SQL Server Enterprise Manager. This property can be changed for existing articles without being reinitialized. The typical use of this property is: exec sp_addmergearticle @publication = N'mypubl1', @article = N'authors', @source_owner = N'dbo', @source_object = N'authors', @compensate_for_errors='false' or exec sp_changemergearticle @publication='mypubl1',@article='authors', @property='compensate_for_errors',@value='false'

Additions to the &quot;sp_addmergearticle&quot; Topic in SQL Server 2000 Books Online
sp_addmergearticle [@compensate_for_errors = ] 'compensate_for_errors' The compensate_for_errors property controls whether the compensating actions are taken when errors are encountered during synchronization. The @compensate_for_errors parameter is defined as nvarchar(5) and has a default setting of true. By default, a change that cannot be applied at a subscriber or at a publisher during synchronization always leads to compensating actions to reverse the change. However, one incorrectly configured subscriber that generates an error can cause changes at other subscribers and publishers to be incorrectly reversed. Setting the compensate_for_errors property to false disables these compensating actions.

Note Setting the compensate_for_errors property to false may cause non-convergence.

Additions to the &quot;sp_changemergearticle&quot; Topic in SQL Server Books Online
sp_changemergearticle [ @publication = ] 'publication', [ @article = ] 'article' [ , [ @property = ] 'property' ] [, [ @value =] 'value' ]

Note Setting the compensate_for_errors property to false may cause non-convergence.

The following select statement determines whether the compensate_for_errors property is set to true or false: select CASE compensate_for_errors WHEN 0 THEN ‘FALSE’ ELSE ‘TRUE’ END from sysmergearticles where name = ‘NameOfTheArticle’ Because the compensate_for_errors property is a shared property for a particular article, its value should to be consistent if the article belongs to multiple publications (such as with republisher scenarios and alternative synchronization partners). This condition is enforced most of the time. However, it is the user's responsibility to make sure that the compensate_for_errors property has the same value for a particular article in all the publications that share the article. Again, this ensures consistent behavior across the topology.

Note If you have to restore a backup of a replicated database that was backed up before this hotfix was applied to the instance of SQL Server, run the sp_vupgrade_replication stored procedure with the required parameters against the instance of SQL Server to use the restored database in replication.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the Standard Terminology That Is Used to Describe Microsoft Software Updates

Keywords: kbbug kbfix kbqfe kbsqlserv2000presp4fix kbhotfixserver KB828637

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.