cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

A large replication got rolled back

Former Member
4,440

Windoze SQL Anywhere 9.something.3951

So I have a large distributed database system...

It's kinda legacy at this point and every few years or so I have a large purge script that will delete multiple years worth of transactions.

We apply the script to the consolidated database and then the delete statements replicate out via dbremote running on a scheduled task.

A month later in production I find that although replication seems to be in synch it's as if the deletes never occurred on the remote database. So then I go back to the log and all I see is a roll back the end of a bajillion deletes.

Any ideas? I realize I'm out of luck being that the Syabse is EOL, and we are trying to move to 16 here shortly... But just kind of curious if anyone has seen this before?

Translating the log with a -g shows me:
CONNECT-1013-017394470350-"10"-2014-04-17 22:48
----BEGIN TRANSACTION-1013-017394470360
--BEGIN TRANSACTION
--UPDATE-1013-017394470406
--UPDATE DBA.Customer
-- SET Changed='2014-04-17 16:09:22.5'
-- WHERE SiteCode='0010'
-- AND CustomerCode='023428'
--UPDATE-1013-017394470593
--UPDATE DBA.Customer
-- SET Active=0,
-- ChangedBy='10',
-- Changed='2014-04-17 16:09:22.6'
-- WHERE SiteCode='0010'
-- AND CustomerCode='027762'
Line 973149
SNIP
Lines upon lines of deletes and marking records inactive...
SNIP
Line 23206783
----CONNECT-1024-017709568341-"10"-2014-04-17 23:33
----BEGIN TRANSACTION-1024-017709568351
--BEGIN TRANSACTION
--COMMIT-1024-017709568358
--COMMIT WORK
--ROLLBACK-1024-017709568359
--ROLLBACK WORK
--ROLLBACK-1013-017709568366
--ROLLBACK WORK

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

I have seen this happen before due to foreign keys. For whatever reason, a remote had a record that didn't exist in the consolidated, so when replication tried to commit the deletions, a foreign key error occurred on the remote. Might be something to look for.

VolkerBarth
Contributor
0 Likes

..though IIRC, that should not rollback the whole huge DELETE but only the operations for those rows that would cause RI violations... - just because it's not the "statement text" itself that is replicated but the resulting operations (i.e. on a row-level), usually applied in grouped transactions (DBREMOTE -g n).

Former Member
0 Likes

Yes, the -g n does affect it. I'm not sure about all cases, but with -g 1, basically no grouping occurs, and they can all go.

VolkerBarth
Contributor
0 Likes

I would think SQL Remote would try to re-do failed multi-row operations (i.e. grouped transactions) by applying them one-by-one.

(Hopefully I don't mix this up with MobiLink's feature to re-apply failed multi-row uploads as single-row uploads...)

Former Member
0 Likes

Thanks for your input, in the case of this database all the relevant child tables are set to cascade delete.

Breck_Carter
Participant
0 Likes

> Hopefully I don't mix this up with MobiLink's feature

Another way to say that is "Hopefully I'm not being like Breck"... it's the reason I've become careful (i.e. reluctant) when answering SQL Remote questions 🙂