N
N
Nikita Permin2013-10-08 10:51:37
CVS
Nikita Permin, 2013-10-08 10:51:37

How to organize conflict resolution?

I'm developing something like a system for collaborating on shared data. Integration with Google Drive is supposed, so we can assume that there is no server, and clients are responsible for the integrity of the data.
1) Let's say there are several clients, they downloaded a common file, went offline and started changing it (first client 1 changed the data, then client 2).
2) Client 1 connected to drive, checked the file version, for example via Custom properties, ( https://developers.google.com/drive/properties) and simply added its data.
3) Client 2 then also connected and saw that the version he had offline was older than the one on the server. How to fill in its changes?
There is an idea to organize all changes in the form of a series of patches (create, update, delete), and when connected to the network, download the latest version of the file, apply patches to it (changes made offline), but at the time the patches are applied on the client side, the data on the server may have time to change. To do this, you can probably organize a file lock through the same Custom Properties, but what if the client does not “unlock” the file? Limit blocking time? It is not very good if there is a lot of data and they will actually be filled in a little longer than this. Or is there a better solution to this problem than my bikes?
upd 1: Small experiments with Google Keep showed that it can't work with conflicts and just compares the file modification time and stores only the latest, ie. in our case, the changes of client 1 will not be saved after connecting to the network of client 2, and the data from client 2 will be the actual data

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
gro, 2013-10-08
@NekitoSP

Yes, as everywhere in the CVS.
If the file is changed on the server, you cannot upload your changed file. You need to download from the server, merge (automatically or, if it doesn’t work out, manually) and upload the resulting file. If during this time the file has changed again, repeat the iteration.

A
Alexey T, 2013-10-08
@Alexeyslav

It seems that you are reinventing the wheel, there are version control systems for these purposes. But they are not focused on arbitrary binary data, they work more with text, and sometimes conflicts arise that, in the general case, are simply impossible to resolve without outside intervention. Imagine a situation where three clients suddenly decide to change the same block, and each presents their own unique changes ... who should be preferred? who is the last one is dad? and if at the same time the 4th and 5th generally propose to delete this part with data and make a dozen more corrections to different parts of the file? With binary data, and even without knowing the features of the file structure and the logic of working with this data, it is impossible to come up with a “universal” solution other than completely blocking the file from everyone while making corrections.

P
Puma Thailand, 2013-10-08
@opium

Everything has been in Google Docs online for a long time, edit online and screw git and teach people how to merge and resolve conflicts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question