Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Conflict Handling: Save Conflict Files to Server #4557

Closed
dragotin opened this issue Mar 9, 2016 · 51 comments
Closed

Improved Conflict Handling: Save Conflict Files to Server #4557

dragotin opened this issue Mar 9, 2016 · 51 comments
Assignees
Labels
blue-ticket Enhancement ReadyToTest QA, please validate the fix/enhancement
Milestone

Comments

@dragotin
Copy link
Contributor

dragotin commented Mar 9, 2016

The clients conflict file handling is not optimal currently because we decided to always prefer the server version over the local changes. That makes us moving the local changed file aside with a conflict file name and download the server version in place.

For the user that means that the local changes of the file are never synced to the server. #3222 #4079

Under the assumption that we want to stick with the server version wins policy we could improve this by supporting version branches in the servers versions app as described here: owncloud/core#23002

Once the client detects a conflict file, it uploads the current local version to the servers version app along with the ETag of the file's predecessor, which is known to the client. That way, the local file version would be saved on the server and data loss would be avoided.

This depends on owncloud/core#23002

The user experience would benefit even more from considering the version branches in #4556

@MTRichards @karlitschek @moscicki @jancborchardt @ogoffart @rullzer your opinions please.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@dragotin dragotin self-assigned this Mar 9, 2016
@karlitschek
Copy link

Hmm. 99.99% of all users seems to be happy with the current conflict files handling.
But a good idea to consider of course.

@moscicki
Copy link
Contributor

moscicki commented Mar 9, 2016

Is there a way to globally check if there are unsynced conflict files? Other than asking every user individually for logfiles or local directory listing ;-)

I think this would help to understand if there is a practical problem or not and maybe this could be a first step to tackling this issue. Would this information be stored in the syncdb journal file (in which case we could try to recall it to the server and analyze the whole bunch automatically)?

I tried to count 412 PUT responses in our http log files but then I realized it is only a subset of conflict cases (and I do not have any feeling how representative this subset is). So I still do not have a solid data point to reason about this issue for our system.

Dropbox does sync conflict files and probably there is a good reason to it. I am not sure if "99.99% of all users seems to be happy" is a good indicator in general because for example "99.99% of all users" did not notice the corruption problem that was actually a serious one (and statistically significant if you have above 10^7-10^8 files in the system).

@scolebrook
Copy link
Contributor

I like this idea but I have a concern in how the average, IT illiterate user, would be able to understand what's happening. If you can have two versions of the same file on two users computers with the same name, that's very bad.

In the event of a conflict, I think a conflict file should be generated and the server copy sync down just as it is now (that tells the user something really, really needs their attention because they always take notice of notifications and messages from the ownCloud app). But the client syncs the conflict file back to the server as a branched version.

This allows the switching of the branch easily. If the branch switches, then the local conflict file goes away as it then becomes a dupe.

One edge case that would need to be considered. User 1 makes an edit that results in a conflict file. A new branch is created. The branch is switched server side so now the official version is the previously conflicted version. User 2 has been offline all this time but has edited the file. They've been working on the now non-current branch. What happens when they come back online. Does their current version sync to the non-current branch and then get replaced by the current branch of the file? How does the software inform User 2 of what has happened? Do the other users get informed that there's now an additional version in the other branch?

Branching is a fairly easy concept to grasp as a developer but I think it's going to take a lot of explanation get that light bulb moment for many non technical users. This is not easy to do in user friendly way. It will take some special UI to make this intuitive.

LibreOffice Online when they implement live collaborative editing + richdocuments is a better solution to this problem IMHO. Avoid the creation of conflicts entirely, then you don't have to deal with them, branching, etc.

@ThaDaVos
Copy link

We are currently running into this problem.
If the client was shut off for like a day, because something happened, or the user accidently turned it off or windows didn't boot the client, when turning it back on, it just overrides all the newer files and generates conflict files.

Maybe instead of doing this, let the user decide who wins, server or client.
Like the QNap QSync client does, everytime there is a conflict it asks what to do, save server version, save client version or generate conflict file.
It also has the option to check a checkbox to have it do the chosen action everytime it has a conflict.

So simply said, let the user choose who wins, the server or the client instead of chosing it for them.

@michaelstingl
Copy link
Contributor

michaelstingl commented Jun 9, 2017

@guruz @ogoffart Could we start with a lightweight approach? Just upload with filename and adding _conflict-$username-XXXX before extension? So everybody can see, there is something that needs to be resolved. I think this requires only minimal or no server-side changes. (Perhaps parameter in config.php and a capability /cc @PVince81 @DeepDiver1975 )

@CJR2
Copy link

CJR2 commented Jun 26, 2017

From an end user perspective, everyone needs/must see that there is a conflicted version. Otherwise, folks will continue to work on their version of the document, rather than get with other document users to resolve the issue.

Agree with @michaelstingl.

Just upload with filename and adding _conflict-$username-XXXX before extension?

Users like our organization, who have used Dropbox in the past, are very used to this happening and have internal processes for resolving these issues between user versions if they do happen.

If the client was shut off for like a day because something happened, or the user accidentally turned it off or windows didn't boot the client, when turning it back on, it just overrides all the newer files and generates conflict files.

Our organization is a relatively large workgroup and have never encountered this issue.

I don't think we should guess what users must experience (99.99%). Instead, why not make this an admin decision? Perhaps make this a selection in the admin console, or if that's not feasible, as a client setting?

@michaelstingl
Copy link
Contributor

Dropbox's approach is pretty straightforward:
https://www.dropbox.com/help/syncing-uploads/conflicted-copy

@dragotin
Copy link
Contributor Author

dragotin commented Jun 26, 2017

I can not really read from the dropbox text above if they have the conflict files all on the server. We did not do that initially as we did not want to spread all conflicts that somebody might create for whatever reason to the harddisks of each and every user of a share. That would probably also confuse people.

I think the only good solution is to do it via the versions app.

@CJR2
Copy link

CJR2 commented Jun 26, 2017

Yes, Dropbox puts all conflicted files on the server (see my original note).

The files are marked with the username as well, which helps in resolving the issues (see attached image at link: [https://dl.dropboxusercontent.com/u/1595301/Capture.JPG]

Think of the organizational disruption if you DON'T spread all conflicts to the server. First, they don't occur very often. When they do, vital information/revisions could be lost.

It is better to have the issue of conflicts than not (again, Dropbox seems to have the best implementation).

On an aside, the Dropbox client monitors if 2 or more users are in the same doc and warns if there's potential for conflict.

@moscicki
Copy link
Contributor

moscicki commented Jun 27, 2017

The first function of a system that automatically handles files on behalf of the user is to protect the data. Local conflict file which is not uploaded to the server is a potential data loss. The larger the system the higher the probability of the data loss.

I would NOT bundle it with the versions app. At least not at the level of sync protocol. A PUT of a conflict file should be marked as such (e.g. using an extra header) and the server implementation should be free to handle it appropriately (e.g. via versions app). I can imagine other implementations, not via a version app but on a separate list on the server.

@dragotin
Copy link
Contributor Author

@moscicki ok, true comment of course. PUTting the conflicted file with an extra header makes sense, but would that PUT go against the original name, or using the usual conflict name with time stamp?

@moscicki
Copy link
Contributor

moscicki commented Jul 15, 2017 via email

@ThaDaVos
Copy link

ThaDaVos commented Jul 15, 2017 via email

@moscicki
Copy link
Contributor

moscicki commented Jul 15, 2017 via email

@CJR2
Copy link

CJR2 commented Jul 15, 2017

Agree with @moscicki, the client should protect the intregity of both the base file and ensure the org does not lose productivity from work completed in a conflicted file but not visible to coworkers and managers.

I've used the dropbox applet that notifies of risk of conflict and 2 things:

  1. You can turn off if annoying
  2. It is really valuable; and don't find it triggered often. When it is triggered I take it very very seriously.

@moscicki
Copy link
Contributor

Hello,

Any news on this?

kuba

@Agator82
Copy link

I agree with @crj2, any chance this feature might come available soon, this is the only issue preventing me from moving this onto a production machine.

@ckamm
Copy link
Contributor

ckamm commented Jan 18, 2018

The current status is that the patch is merged and the behavior can be enabled though a server capability.

@ckamm ckamm added the ReadyToTest QA, please validate the fix/enhancement label Jan 18, 2018
@julesmoretti
Copy link

@ckamm - Having the same issue here, running 2.4.0 build 8836 for mac.

Do you know which release will hopefully cover this fix?

Thank you for your support with this :)

@ckamm
Copy link
Contributor

ckamm commented Jan 22, 2018

@julesmoretti The patch is available in 2.5.0 and onwards. This is currently controled by a server capability that has no configuration in the server yet.

@julesmoretti
Copy link

@ckamm also do you know this will also handle the There are unresolved conflicts. Click for details.

And upon clicking on details:

Issue
Conflict: Server version downloaded, local copy renamed and not uploaded.

Just to make sure :)

@ckamm
Copy link
Contributor

ckamm commented Jan 25, 2018

@julesmoretti Yes, if conflict-uploading is enabled, the message will just speak about an unresolved conflict, and not say that the file was not uploaded. :)

@SamuAlfageme
Copy link
Contributor

SamuAlfageme commented Apr 11, 2018

I think it's fair to close this one out. Has been broadly tested, improved and after #6441 even documented.

There are also great concepts like #5896 in the making. Someday we clients might as well get the formal concept of conflicts we can use from the server.

Great job @ckamm! 👏

@guruz
Copy link
Contributor

guruz commented Jul 23, 2018

@guruz
Copy link
Contributor

guruz commented Jul 23, 2018

I forgot to paste the download link to 2.5.0 beta1.
Here it is: https://central.owncloud.org/t/desktop-sync-client-2-5-0-beta1-released/14667

@dragotin
Copy link
Contributor Author

Hm, the documentation lacks an explanation what you can and should expect when enabling that feature. So I doubt many people will test.

@jnweiger
Copy link
Contributor

jnweiger commented Aug 8, 2018

linux mint tara

testpilotcloud version 2.5.0daily20180808 (build 10016)

Feature must be enabled through

  • a server capability 'uploadConflictFiles'
  • or through environment variable OWNCLOUD_UPLOAD_CONFLICT_FILES=1

Provoke a conflict by

  • wait until sync finished. pause sync.
  • modify file in the web gui
  • modify file locally
  • resume sync.

BAD: replacing the file on the server does not cause a conflict, it explodes: #6701

PUT requests on a conflict should contain
PUT path/to/base_conflict_testuser-1234.txt
OC-ConflictBasePath: path/to/base.txt
X-OC-Mtime: (as usual)

Tentative:
OC-ConflictBaseEtag:
OC-ConflictBaseMtime:

OK: mitmproxy shows

Content-Type:           application/octet-stream
OC-Async:               1
OC-Checksum:            SHA1:4177821dbc55969573e5189bd757579af421a71a
OC-Chunk-Size:          10000000
OC-Conflict:            1
OC-ConflictBaseEtag:    4d9bd6cb0b8d2d090aa09b06dad4944f
OC-ConflictBaseFileId:  04400434oce9akr7u3v9
OC-ConflictBaseMtime:   1533747765
OC-Total-Length:        147
X-OC-Mtime:             1533747765

BAD: OC-ConflictBasePath is 'documented' in the issue, but missing.

Maybe server would do nice versioning for that in the future?
OK: 10.0.9 not yet.

Both original file and conflict file are on the server, and
must be rsynced down to other clients.
OK

Even older conflict files get uploaded once the upload conflicts feature is enabled
OK

BAD: username is missing in the conflict files that were generated before the feature is enabled.
grafik

BAD: The tab 'not synced' now talks about a nicely synced (conflict) file.

@jnweiger
Copy link
Contributor

jnweiger commented Aug 8, 2018

@dragotin people not testing stuff has many reasons. There is documentation, hooray!!!!. It could be worse!!! Actually I didn't read that snippet in the first place and discovered the environment variable in the source...

enhancement request: That behaviour should be made default asap! It is a huge improevement to have the conflict files on the server. Even if the server does not do any extra magic right now. It is a great feature!

@moscicki
Copy link
Contributor

moscicki commented Aug 9, 2018

@jnweiger: your test can easily be automated with smashbox and thus effortlessly rerun at will until the end of world. we can have a look at this together.

@dragotin
Copy link
Contributor Author

dragotin commented Aug 9, 2018

@jnweiger in your testcase where you modify both on server and client (to actually create the conflict), which version is the file with the original file name after the whole conflict sync happened?
It is probably still the server version, as it was before?

Maybe that really should be changed now and make it the latest version, ie the one that was modified last? Is that what user expect?

@ogoffart
Copy link
Contributor

ogoffart commented Aug 9, 2018

BAD: OC-ConflictBasePath is 'documented' in the issue, but missing

Can you please open an issue for that?

BAD: username is missing in the conflict files that were generated before the feature is enabled.

I suppose that's fine.

BAD: The tab 'not synced' now talks about a nicely synced (conflict) file.

Right.... Although it is still nice to have this information there since we want to act upon this.
There is code for this condition that explicitly add the conflict files there even though they are sync'ed.
Maybe a better UI is needed (another tab?)


@moscicki : We also have automated testing for this feature here: https://github.com/owncloud/client/blob/master/test/testsyncconflict.cpp But of course, this does not replace real testing on a real server.

@jnweiger
Copy link
Contributor

jnweiger commented Aug 9, 2018

@dragotin Yes in all cases of conflict tested, the version from the server was kept in place, versions from the local client were renamed.

Assuming nobody edits on the web interface, but all changes come through syncing clients, the client that syncs first would win. Which is the opposite of your suggestion "last client should win".

A strong reason for "last edit wins" would be if we could assume that later authors have seen, considered and rejected (or merged) earlier changes. In our case they cannot see each other until after the conflict.
A weaker reason is its simpler overall logic compared with 'first sync to server wins'.

The timestamp should be the modify timestamp of the file on the client. Not the moment when it got successfully synced to the server. Right?

@jnweiger
Copy link
Contributor

jnweiger commented Aug 9, 2018

@ogoffart right, those other 'BAD' items are acceptable for me too. Thanks to your review, one of them is now an issue: #6702.

@jnweiger
Copy link
Contributor

Enhancement idea: environment variable OWNCLOUD_UPLOAD_CONFLICT_FILES=1 should be a config file setting.

@zippytiff
Copy link

Agreed, make this a config file setting and corresponding gui setting

ZT

@gessel
Copy link

gessel commented Nov 22, 2018

There's a great little program called "allwaysync" that has a lovely conflict resolution tool. The key to the program's utility is that the conflict list is provided for in-program resolution. I have a folder with a lot of meta information modifications which generate conflicts with the server. The local files have the latest data, but they were all renamed. Now there's no straight-forward way to, say, select all of these conflicts and specify that the local file wins, please delete the copied down server file, un-rename the local file, and sync back to the server. That is, how about a UI tool that allows straight forward manual selection of which file should win and then executing that directive?

@gessel
Copy link

gessel commented Nov 22, 2018

It seems that if you rename the conflict file to overwrite the original, it then takes precedence over the server file and the next sync will overwrite the server without generating a conflict report.. So the problem of deconflicting client precedence is only to bulk rename all the conflict files overwriting the copies downloaded from the sever like:

  find -iname *_conflict-2016* -type f -exec rename -n -f 's/_conflict-2016[0-9]{4}-[0-9]{6}//' {} \; 

as a dry run, then removing the "-n" flag to really do it like:

  find -iname *_conflict-2016* -type f -exec rename -f 's/_conflict-2016[0-9]{4}-[0-9]{6}//' {} \;

This will recurse through directories below where the command is executed, so be warned if some conflicts should be resolved with the server file taking precedence.

Note that all my conflicts seem to have "2016" as the prefix, YMMV on that. If the years vary, something like

 find -iname *_conflict-* -type f -exec rename -n -f 's/_conflict-[0-9]{8}-[0-9]{6}//' {} \;

should do the trick, as long as "_conflict-" isn't used

@gorn
Copy link

gorn commented Dec 10, 2018

The worst thing in all this is, that there is really no SANE way to resolve the conflict. The only way which works is to open the server version file and the local one (renamed to conflict file) and copy the contents of the local file into the server one). This might be possible with simple text files, but it is nearly impossible with more complex data, like graphics files, databases, etc. etc.

This should work (and does NOT):

  • delete the server file
  • rename the local "conflict" file to the original name.

After these asctions synchronization should understand that the user wants to keep local changes and upload them to the server. However it does not work now. It sais, that the server responded that the file is LOCKED. I use client 2.5.1 on Linux Mint

@lowlyocean
Copy link

lowlyocean commented Jan 28, 2019

Am I missing an obvious "bulk resolve" to select local versions of all files currently in conflict? My server was down for a while; now all of applications are loading stale data from the server because my fresher local files have been renamed.

@ckamm
Copy link
Contributor

ckamm commented Jan 29, 2019

@lowlyocean There's currently no bulk-resolve option. #5896 is an issue about providing more conflict resolution ui help but that's not yet scheduled or even fully thought through. Until then, check out the renaming console commands mentioned above.

The client tries hard to avoid creating unnecessary conflict files. For example it'll only ever do it in situations where the server reports a file change (i.e. the server file's etag differs from the locally recorded etag). If you still have information about the situation that caused conflict files to be created in a "pure backup" situation that'd be very much worth a report.

Optionally limiting client behavior for "pure backup" operation may be a worthwhile discussion to have.

@lowlyocean
Copy link

lowlyocean commented Jan 29, 2019

It concerns me that conflict resolution is proposed as a server-side task. I'm running on a raspberry pi and try to avoid the web interface as much as possible because it is slow to load. The more the client can do, the better.

If I'm not using nextCloud for collaboration, I shouldn't see any conflicts. It should be assumed my local copies are the most recent and back them up to the server.

@ckamm
Copy link
Contributor

ckamm commented Jan 29, 2019

I agree that conflict resolution is usually a local task, that ticket is about giving users better support for resolving conflicts locally through the sync client.

@lowlyocean
Copy link

locally through the sync client Yes, this is good. I should clarify that I was concerned about suggestion in #5896 (comment)

Good work so far, I've noticed lots of improvements like reduced time for client scan for changes. Very much looking forward to DeltaSync feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blue-ticket Enhancement ReadyToTest QA, please validate the fix/enhancement
Projects
None yet
Development

No branches or pull requests