vrtmrz / obsidian-livesync

MIT License
5.16k stars 167 forks source link

lates 0.23.22 deleted all files on some devices #492

Open mlause opened 2 months ago

mlause commented 2 months ago

Abstract

Expected behaviour

Actually happened

Reproducing procedure

  1. Upgrade to 0.23.22
  2. Mark iPhone as database ready
  3. Unlock database on Mac
  4. Mac syncs with all files deleted
  5. Rebooted iPhone and after sync all files deleted.
  6. Luckily iPad has all the files
  7. Enabled fetch for hidden files

Note: If you do not catch the reproducing procedure, please let me know the frequency and signs.

Report from the LiveSync

vrtmrz commented 2 months ago

Thank you for opening the issue!

I think that this might be complicated. Sorry if I said something out of line. Basically, nowadays, we are (or should be) completely freed from manually unlocking. Usually, Rebuld from some device will lock the remote database, and Fetch on each device unlocks the database for itself.

If the lock/unlock is performed manually, some sequences may cause a serious problem. And, it is important that; configuration mismatched vaults mostly cannot be synchronised without trouble. Was Configuration mismatched dialogue shown?

mlause commented 2 months ago

I did not get a mismatched configuration dialogue. I had yet to set up obsidian on my laptop. I tried just now, and syncing the database there are only 2 notes out of 60 something.

This is interesting. I decided to go into couched to look at the database. All of the notes seem to be there but only the 2 are syncing. What would cause only a couple of files to synchronize?

Edit: I clicked on xxxfile.md to see what was shown. On the notes that are deleted, I see a comment at the end that says "deleted": true.

Edit 2: I found a file that does not have the deleted value and is not showing up in obsidian.

tomsimonart commented 2 months ago

Same here, I don't know what happened, it asked me something about chunks and case sensitivity, pressed yes to update, deleted all my files and this behavior replicated to my other devices, lost 400 notes and I don't know what to do

vrtmrz commented 2 months ago

@mlause Thank you for checking the configuration! Was your plugin the latest version? I think that it would be safe to rebuild the database from your iPad; which is the most reliable device for now. (Of course, please make the backup. I am always using Files app on my iPhone).

We can rebuild the database from the Maintenance pane in the setting dialogue. (Rebuild everything is so).

@tomsimonart

I am so sorry for your trouble. If you did not disable that, deleted files could be seen in .trash folder on your device. (Or, the second chance is your device's trash bin). Would you mind if I ask you to please check these places once?

And, I think that it will be so harsh to apply this method to 400 files, but we can show the file history on Pick a file to show history. If your files were not actually exist anymore but you could pick a file, you can restore from them. If it effective, I will happy to write a workaround, that resurruct all deleted files.

mlause commented 2 months ago

@vrtmrz I did your recommendation and pushed the iPad db to couchbase. The process completed without errors. I then fetched the db from my iPhone and Mac. It pulled all the notes. Now I have a sync problem. I made some changes on my iPhone that did not get picked up on my iPad or Mac.

tomsimonart commented 2 months ago

@mlause Thank you for checking the configuration! Was your plugin the latest version? I think that it would be safe to rebuild the database from your iPad; which is the most reliable device for now. (Of course, please make the backup. I am always using Files app on my iPhone).

We can rebuild the database from the Maintenance pane in the setting dialogue. (Rebuild everything is so).

@tomsimonart

I am so sorry for your trouble. If you did not disable that, deleted files could be seen in .trash folder on your device. (Or, the second chance is your device's trash bin). Would you mind if I ask you to please check these places once?

And, I think that it will be so harsh to apply this method to 400 files, but we can show the file history on Pick a file to show history. If your files were not actually exist anymore but you could pick a file, you can restore from them. If it effective, I will happy to write a workaround, that resurruct all deleted files.

No need to be sorry ! I'm very grateful that this plugin exists anyways 👍 In the meantime I used a side backup to fix the issue, the process I used was:

  1. Restart obsidian
  2. Delete everything and re-create vault
  3. Put files back in the vault
  4. Re-install live sync
  5. Indeed it tells me that remote db has already migrated to new settings
  6. Uncheck the old behavior in the settings for "case sensitive" + uncheck the old behavior for file chunks
  7. Delete remote db and re-apply local files
  8. On any subsequent devices, first uncheck the old behavior before syncing

I'm not on my machine where the issue happened but i'll check the trash, If I find anything I'll post here again

viraptor commented 2 months ago

I ran into the same issue. The I'm sticking with the case sensitive files, but not the new chunks. I don't know exactly why, but new chunks simply stopped being uploaded. I got new nodes for documents which had a child, but the referenced chunk document did not exist at all. A full rebuild from maintenance solved it, but still 😬