September 25, 2017 at 6:35 am
I have an SQL server database setup for replication, My boss asked me what happens if I change a record locally offline, but the record was changed on the master replicant database before I reconnect.
What conflict resolution does SQL Server employ?
Any thoughts on this would be greatly appreciated.
Paul
September 25, 2017 at 6:40 am
I'm not sure I understand why you would even ask that question. The purpose of replication is to keep a working copy of a database current, and usually in near real time, so what possible motivation is there to make a change to the copy by any methodology other than indexing? Why would you ever want to make changes to that copies data?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 25, 2017 at 6:44 am
It depends on the type of replication deployed.
Merge replication has conflict detection and resolution built in, lots on Google and Microsoft on how it works and you can also write your own routines to do it if you don't like the MS ones.
Transactional and Snapshot replication don't have conflict detection and resolution as they are supposed to be exact copies of the data either transactionally as it happens or on a scheduled snapshot of data. So you update anything on the subscriber it stays that way until the next transaction to that row or snapshot is applied. Again as Steve just said why would you be doing updated subscribers.
September 25, 2017 at 7:39 am
We have an android application that uses some XML files to store offline data.
When a user is connected to a wifi network, the app with start sending any updates back to the applications SQL Server.
That all works, but sometimes if the data has had an update applied on the application SQL Server overnight when the android app reconnects, it crashes when processing the update.
I think my question would be more based around the concept of what would SQL Server replication do?
a) Overwrite the data in the application SQL Server
b) Error because the data held on the application SQL Server had been modified
c) Or something else
Paul.
September 25, 2017 at 8:07 am
Paul Giles-Randall - Monday, September 25, 2017 7:39 AMWe have an android application that uses some XML files to store offline data.
When a user is connected to a wifi network, the app with start sending any updates back to the applications SQL Server.
That all works, but sometimes if the data has had an update applied on the application SQL Server overnight when the android app reconnects, it crashes when processing the update.I think my question would be more based around the concept of what would SQL Server replication do?
a) Overwrite the data in the application SQL Server
b) Error because the data held on the application SQL Server had been modified
c) Or something elsePaul.
It may be that the application itself verifies that the data it's trying to update hasn't been changed, but that feature was implemented in such a way that it crashes rather than report an error.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 26, 2017 at 12:49 am
Paul Giles-Randall - Monday, September 25, 2017 7:39 AMWe have an android application that uses some XML files to store offline data.
When a user is connected to a wifi network, the app with start sending any updates back to the applications SQL Server.
That all works, but sometimes if the data has had an update applied on the application SQL Server overnight when the android app reconnects, it crashes when processing the update.I think my question would be more based around the concept of what would SQL Server replication do?
a) Overwrite the data in the application SQL Server
b) Error because the data held on the application SQL Server had been modified
c) Or something elsePaul.
I don't think replication would help you here, unless your talking about installing SQL on the android devices with local copies of the database and then using them as publishers back to the main SQL server, if so you would need to use Standard or Enterprise edition as the other editions can only be a subscribers.
You will need to build some custom logic into your application to check the XML file load and check if that data has already been modified and gracefully handle the error if it has.
But what would replication do, depends on the type of replication, Transactional / Snapshot would overwrite the data in the subscriber, the publisher is master and will always update to what the publisher is, Merge if you do conflict resolution and detection will try to resolve the conflict.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply