We have recently moved our application to Azure as well as the databases that it runs on. We have multiple clients across the globe and we are periodically moving them all to use the application in Azure. Merge Replication is used to keep all the databases in sync for our clients that are using Azure as well as the clients not yet moved to azure which are still operating on their local servers.
After moving the databases to Azure and setting up Merge Replication to Azure with one of our servers in the internal network acting as the publisher and distributor and Azure acting as a subscriber, merge replication started to act funny. We have clients that update data on the application in Azure and after a few minutes the transaction will be rolled back. By checking the conflict table, some of these records are there and the conflict states that the record was updated by both the publisher (Internal) and the subscriber (Azure) where the record for the publisher was chosen as the winner and the change is rolled back. After selecting the new winner, the change goes through. We implemented an audit trail on Azure, the publisher as well as the server on which the client which now runs in Azure use to run on which consists of AFTER INSERT, UPDATE and DELETE triggers which inserts te records into a history table. By analyzing the audit trail we have noticed that merge replication sends the same update about 5 times but this does not happen every time and is quite erratic. We can also see that the record is updated in Azure, replicated to the publisher and then to the clients old server which is expected and all record are the same. Happy Days. A couple of minutes later, the publisher sends a new row to the subscribers reverting the row to which it was previously. Weird and frustrating!
My questions are thus:
Is there any specific way to set up Merge Replication where I have an internal network publisher with multiple internal network subscribers and one Azure VM (IAAS) subscriber
Will it help if I set up the Azure subscriber to use pull subscriptions instead of push subscriptions as it is currently set up?
Why would the publisher detect the update as a conflict if it has already been updated on the Azure subscriber, the clients old subscriber and the publisher successfully as shown by the audit trail?
Why would merge Replication send the same update 5 times for the same update?
I really hope you can help. I have googled google to a point where I dont know what to google for any more and I am no closer to an answer and this is driving me crazy and it is causing a lot of support query overhead.
Any input and advice will be appreciated.