uSync-Legacy icon indicating copy to clipboard operation
uSync-Legacy copied to clipboard

Errors during Sync: Violation of PRIMARY KEY constraint 'PK_umbracoLog'.

Open jbolthouse opened this issue 8 years ago • 2 comments

I just performed a SQL Server Replication to a dev host from my production instance, and I am getting this very strange error and dying on at 500.

https://pastebin.com/bC2qnquU

Totally stuck... not sure what I should do next.

jbolthouse avatar Feb 27 '18 23:02 jbolthouse

HI

i think something happened with your replication, the error is from umbraco putting something in the Umbraco Log table (i suspect because a delete has been called) uSync doesn't directly do anything with the umbracolog table, so it's more likely the primary index is somehow out of sync ? so a new insert by umbraco is putting something in with a key that is already there.

I would blank the umbraco log table to see what that did - but i wouldn't be surprised if other tables have the same issue so you will hit errors somewhere else.

KevinJump avatar Feb 28 '18 09:02 KevinJump

Hi Kevin,

After some digging, I think I have found the culprit.

When SS does replication, it alters the fundamental structure of the primary keys in a table, so that the IDENTITY structure no longer works the way it does in a non-replicated scenario. This means that that the "identity inserts" that the Umbraco API uses to write its data (and for that matter just about every other application that uses auto-inc PK data normalization in SQL Server) will fail to retrieve an accurate PK next ID. This causes the PK violation collisions.

It has something to do with partitioning the key for the subscribing servers. One day when I am really bored or desperately trying to engage a one-to-many sub model for replication, I will figure out what is going on. But for now, crisis averted.

Thanks for your quick responses. You and your fabulous uSync are reasons to love the Umbraco community.

Thanks again!

On Wed, Feb 28, 2018 at 2:17 AM, Kevin Jump [email protected] wrote:

HI

i think something happened with your replication, the error is from umbraco putting something in the Umbraco Log table (i suspect because a delete has been called) uSync doesn't directly do anything with the umbracolog table, so it's more likely the primary index is somehow out of sync ? so a new insert by umbraco is putting something in with a key that is already there.

I would blank the umbraco log table to see what that did - but i wouldn't be surprised if other tables have the same issue so you will hit errors somewhere else.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KevinJump/uSync/issues/164#issuecomment-369171640, or mute the thread https://github.com/notifications/unsubscribe-auth/AASr5Dc8b7IzYJP1DLU3l0Y-BXb9b62eks5tZRmbgaJpZM4SV0yb .

-- John Bolthouse https://www.linkedin.com/in/johnbolthouse https://www.linkedin.com/in/johnbolthouse May all our earnest efforts to accomplish anything find themselves seasoned with salt.

jbolthouse avatar Mar 09 '18 12:03 jbolthouse