jasminb / megastoragemanager

Android application providing sync and data management tools for mega cloud storage
5 stars 2 forks source link

Two-way sync losing data when syncing edit conflict #17

Closed ja02 closed 9 years ago

ja02 commented 9 years ago
  1. Create cloud folder CF1 containing single empty file f1.txt.
  2. Create a sync on a computer from CF1 to a local folder (via the MEGASync program).
  3. Create two-way sync on a mobile from CF1 to a local folder (via MSM).
  4. Edit the local f1.txt on a computer by adding single letter 'C'.
  5. Wait for the change to upload to the cloud (verify via Web access).
  6. Edit the local f1.txt on a mobile by adding single letter 'M'. Trigger sync process manually.

Error: f1.txt is downloaded from cloud and overwrites the local file. In addition, MSM then uploads another file f1.txt to the cloud (so the folder CF1 now contains 2 files with the same name), but the newly uploaded file contains letter 'C' as well. The data entered locally on mobile (letter 'M') is lost. Expected: One possible solution would be if MSM kept the 'M' version in a new file, e.g. _f1CONFLICT.txt (perhaps with an option to choose whether it should be uploaded or stay just on a local storage). Further conflicts could add another number after the word _CONFLICT. Would be nice if the user was somehow informed about the existence of the conflict somehow.

jasminb commented 9 years ago

I think this could be caused by the way MEGA provided sync tool is handling syncs.

Can you let the windows APP perform initial sync and than turn it off, after that, edit the file on the phone and document what happens?

ja02 commented 9 years ago

I turned off the Windows APP right after it uploaded the change (otherwise the whole scenario would make no sense). Same result.

jasminb commented 9 years ago

Conflicts are now prefixed with 'Conflcit_' prefix instead of deleting/replacing files (MEGA-2.1.0-test6.apk)

ja02 commented 9 years ago

I have been unable to test this scenario properly, because, for a reason unknown to me, the item 5. now works differently - instead of saving the changes to f1.txt, it creates another file with the same name but the new content. Will investigate further. But data from mobile still seems to be lost (both f1.txt and _Conflictf1.txt contain the content from computer).

ja02 commented 9 years ago

As already stated in the previous comment, I had been unable to create a conflict with the MEGASync app, so I tested on 2 android devices instead.

  1. Create cloud folder CF1 containing empty file f1.txt.
  2. Create a 2-way sync on device1 between CF1 and an empty local folder, with delete local/remote options enabled and manually sync (f1.txt will be downloaded).
  3. Create a 2-way sync on device2 between CF1 and an empty local folder, with delete local/remote options enabled and manually sync (f1.txt will be downloaded).
  4. Add text dev1 to f1.txt on device1 and manually sync (f1.txt will be uploaded).
  5. Add text dev2 to f1.txt on device2 and manually sync.

Expected: The content of file f1.txt should change to text dev1 (after download from cloud). A new file _f1Conflict.txt with text dev2 should be created locally on device2. The cloud should sync to contain both files with the same content. Device1 should sync to contain both files with the same content. Error: f1.txt disappears on device2. _Conflictf1.txt is created, but disappears after some time. In the end, both files disappear on both devices and also from the cloud (all data lost).

Please also notice the word _Conflict is a postfix, not prefix. First, this makes is reside near the original file when sorting by name. Second, if there are further conflicts, it's possible to use another numeric postfix, e.g. _f1Conflict4.txt.

ja02 commented 9 years ago

It has been decided to change strategy to a "Last uploader wins" approach.