2

How do you manage two-way synchronization between a 'main' database server and many 'secondary' servers, in particular conflict resolution, assuming a connection is not always available(offline syncing)?

For example, I have an Android application which is use data from local database(sqlite). And user can deal with data even it is online or offline. In meantime when if it is online, then local database(sqlite) should sync with real database(mysql) in the server and resolve conflicts as a background service.

Is there any solution already implemented for this kind of scenario ?

I heard about Couchdb which is a NoSQL solution can be a solution for this. If it is so Can I use it with SQL ?

asked Nov 9, 2015 at 9:35
2
  • Depends entirely on the database structure in question. The proper way is to make things so there can be no conflicts, but that's not always possible. Commented Nov 9, 2015 at 10:21
  • As I know Couchdb and Couchbase Mobile SyncPoint have offline syncing and conflict management features. But they both are NoSQL. Is there a way to make them to use other SQL database instead of NoSQL ? Commented Nov 9, 2015 at 10:28

1 Answer 1

0

Basically you would need to take the commit logs from both databases and compare them, looking for instances of updates to the same table and row (and possibly column) in both databases. Any commit records for rows not in conflict can be sent to the appropriate database (i.e., a commit record from the master can be transformed into an appropriate CRUD statement and issued to the client), all rows in conflict will have to have their commits ordered temporally and the last commit issued would "win". If the commit logs are not retained, you'll have to keep them manually (probably by structuring your updates using the command pattern). This is a non-trivial exercise.

answered Nov 9, 2015 at 17:10
1
  • Is there any existing frameworks or implementation I can use to resolve this issue ? Commented Nov 11, 2015 at 6:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.