views:

22

answers:

0

I'm thinking of adapting a current database application to have a persistent web-based component. The idea is to have a local client version that can be run whether or not the client has connectivity. The data for the application is stored in a local database. What I'd like to have is that, whenever the client does have connectivity, then it will use the "master" database over the web. However it will maintain a local replication. If connectivity is lost the client program will use the local database and maintain some kind of "diff" structure. Then when connectivity is restored it will try to synchronize with the master by applying the diffs.

This is a new concept for me and I'm not really sure how to go about applying it. The application is currently based on MySQL so if there are any tools or if there have been any public discussions or articles on how to go about designing such a synchronization process for a collection of MySQL datbases... I am unaware of what they are and would appreciate someone pointing me in the right direction.

Right now, I think I'd like to implement a synchronization mechanism that works somewhat like GIT's. When connectivity is restored the local database rolls back to the point where it was last in-sync, then it downloads all changes from the master, and then tries to apply all of the local diffs in order. When it hits a conflict, then it prompts the user to resolve it.

I guess my question can be summed up as: are there any standard practices for implementing parallel, asynchronous, bulk access to a MySQL database?

Note: this question is similar to (http://stackoverflow.com/questions/1085677/syncing-between-two-databases) but that one wasn't really answered in my mind. For my application, I inherently expect the master database to be at a different state than when the local application last connected to it.

Edit: From the MySQL reference manual, section "13.6.9: InnoDB Multi-Versioning" it seems like there is a "versioning control system" built into to InnoDB but the documentation seems a little lacking on how to actually use it. Or maybe I just don't understand transactions that well (currently I'm MyISAM).