all groups > sql server replication > july 2006 >
You're in the

sql server replication

group:

sp_MSdel method invoked when an update was performed on the publis


sp_MSdel method invoked when an update was performed on the publis Larry Herbinaux
7/27/2006 2:59:02 PM
sql server replication:
I have been able to reproduce this error twice. In general, the sp_MS*
procedures are working fine on all of the other tables that I have tested so
far, but for our PointOfSales table, the distribution agent tries to execute
the following:

{CALL sp_MSdel_PointOfSales (4952)}
Transaction sequence number and command ID of last execution batch are
0x0001431300005005000100000000 and 1.

and we receive the following error:

DELETE statement conflicted with COLUMN REFERENCE constraint
'FK_AS_AuthorizedIPs_PointOfSales'. The conflict occurred in database 'Indy',
table 'AS_AuthorizedIPs', column 'PointOfSaleID'.
(Source: SDCSQL2 (Data source); Error number: 547)
---------------------------------------------------------------------------------------------------------------
The row was not found at the Subscriber when applying the replicated command.
(Source: SDCSQL2 (Data source); Error number: 20598)
---------------------------------------------------------------------------------------------------------------


We did not perform a delete command at the publisher and the row still
exists in the PointOfSales table at the publisher. We did perform an update
on a single column of this table when this error occurred.

Has anyone ever seen issues like this before?

Also, once this occurs, I have to disable replication and add it back in.
This is ok for the testing that I am doing because I'm checking each table
one at a time and watching the distribution agent for errors. The idea here
is to work out all of these issues before it's installed into production, but
I'm wondering if there is a white paper out there that might suggest how to
recover from these issues (e.g. if this had actually occurred in production,
I'm sure that there would be a lot of other transactions backed up due to the
error, it would be nice to clear the error, run the consistency check and
then perform a snapshot on the specific articles that are out of
sync...unfortunately, I don't know how to clear the issue without disabling
replication).

Thanks,

Larry Herbinaux
Re: sp_MSdel method invoked when an update was performed on the publis Paul Ibison
7/28/2006 12:00:00 AM
This applies to updates of columns which are part of a unique index and is
known as a deferred update. You'll know when it's happening as the procedure
sp_MSupdtablename never executes on the subscriber, only the
sp_MSdeltablename and sp_MSinstablename procedures (although this could also
occur if the snapshot commands tab shows 'NONE' for the update command!).
Implementing trace flag 8207 will replicate the update as an update on the
subscriber, but only if it is a singleton update. See KB Article
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q302/3/41.ASP&NoWebContent=1
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Re: sp_MSdel method invoked when an update was performed on the pu Larry Herbinaux
7/28/2006 11:27:02 AM
Thanks for the info Paul,

The column that is being updated is not part of a unique index. As for the
second possibility, I'm not quite sure what you mean by "this could also
occur if the snapshot commands tab shows 'NONE' for the update command". We
don't do snapshot replication, rather on initial install, we have the exact
copies of the databases on both the publisher and subscriber. We generate
the sp_MS* stored procedures by running the sp_scriptpublicationcustomprocs
command on the publisher and running the results on the subscriber. In your
statement above, I think you are talking about the check box for the update
command on the commands tab for the default table article properties which is
checked to use the spMSupd* stored procedures. Is this what you are
referring to?

The symptoms that are occurring do sound like a deferred update. I
obviously would rather this occur as a normal update rather than a delete /
insert, but the most disturbing thing is that the delete part does not work
because it fails to perform the deletes on the table dependencies (e.g.
removing the associated rows in other tables that contain this table's
primary key as a foreign key). Is this a known issue of deferred updates?
Is there a work around if one decides not to use the -T8207 option?

I will try the work around. We are a candidate for this solution because we
are doing a one-way transactional replication from publisher to subscriber.
The publisher is our TX database server and our subscriber is our Reporting
database server (offloading reporting requests so that we have better
concurrency for transactions).

One other question that I have is if there are inconsistencies with some
table articles between the publisher and the subscriber, what is the best and
quickest way of resolving these inconsistencies. Is there a way to do this
on a per table article basis? The reason why I ask this is that our plan is
to truncate all tables that have to do with "application transactions" on the
TX database server so that we can guarantee a certain transaction latency no
matter how many transactions that we have processed. So in this case, the
tables that have to do with "application transactions" will contain less data
on the TX database server than on the Reporting database server and we don't
want to wipe out our historical transactions on the Reporting database
server. The method that I am going to try is to drop replication and setup
replication on all tables minus the "application transactions" tables,
perform a snapshot replication on the table articles and then add the other
tables as articles after the snapshot replication. This seems like a very
arduous process...any suggestions?

[quoted text, click to view]
Re: sp_MSdel method invoked when an update was performed on the pu Larry Herbinaux
7/28/2006 3:37:01 PM
Thanks again Paul,

I have one last question concerning the cascading deletes remark. The issue
here is that when the publisher decides to do the deferred update, the
publisher is not first sending the deletes for the tables that rely on the
the primary key that will be deleted. I agree that this should all be
transactionalized correctly from the publisher to the subscriber, but it
doesn't seem to be.

I did try the -T8207 and it fixed the problem although all our updates may
not be singleton updates, so I would really like to try and understand the
issue described above.

Thanks,

Larry Herbinaux

[quoted text, click to view]
Re: sp_MSdel method invoked when an update was performed on the publis Hilary Cotter
7/28/2006 6:58:53 PM
On the publisher right click on the problem table, select Design Table and
click on the hand icon and then the Relationships tab. Ensure that the
enforce relationship for replication is checked.

If it is not cascading updates and deletes will be performed on the
subscriber, and then the replicated commands which form the cascading
updates and deletes on the publisher will be replicated as well.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



"Larry Herbinaux" <LarryHerbinaux@discussions.microsoft.com> wrote in
message news:4684CB47-3E4D-45C8-B1E6-79B4BB45D06D@microsoft.com...
[quoted text, click to view]

Re: sp_MSdel method invoked when an update was performed on the pu Paul Ibison
7/28/2006 10:01:18 PM
Larry,
it does sound like a deferred update, which can also be the result of
indexed view indexes.
As for cascading of deletes, the usual practice is to not have these running
at all on the subscriber. The subscriber usually gets all its data from the
publisher in transactional replication.
For the last part, what it sounds like to me is having 2 publications. One
of them contains the "application transactions" and before the truncate
occurs on the publisher, you drop the subscription, do the truncate then do
a nosync initialization. The 2 publications share the same distribution
agent to maintian consistency.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Re: sp_MSdel method invoked when an update was performed on the pu Paul Ibison
8/1/2006 12:00:00 AM
Larry - the cascaded deletes don't occur on the publisher so are not
replicated.
If you had a delete insert pair on the publisher, and this was within a
transaction that cascaded the deletes, then replication would pick it up.
I agree that in your case there is an issue. You could try using FK Not For
Replication, as presumably it isn't the PK that is being altered, so
referential integrity should be maintained after the delete/insert pair.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

AddThis Social Bookmark Button