WebDAV use failsafe sync

Hello,
I just discovered Joplin when searching for a notebook app (Android). Open-source and WebDAV sync sound great!

When starting, I’m a little surprised:
Why does synchronizing with WebDAV against an empty directory deletes your notebooks?
Just for that purpose is the “Fail-safe” option, isn’t it?
“Do not wipe out local data when sync target is empty”.

But the FAQ even confirms this behaviour for WebDAV:
https://joplinapp.org/faq/

Well, the notes are moved to the “Conflicts” folder, but nevertheless.
"Fail-safe: Sync was interrupted because 100% of the data is about to be deleted. To override this behaviour disable the fail-safe in the sync settings."i
Despite of this message, the old notebooks are missing and you can’t move the conflicts back.

=> Wished feature: If “failsafe” is activated, just sync even if the directory is empty.

What you want is not sync, but export to a remote directory, and indeed this is not currently supported.

Technically, there may be a subtle difference between (first-time)-sync und export.
I think, most users won’t recognize it.

1 Like

This has been a misunderstanding for most people. Sync is not Export (or backup)!!!

Joplin uses a 2-way sync. A 2-way sync is defined as follows: changes that are applied to either of the targets will be synced to the other.

Pointing the sync target to an empty location will replicate the empty target to the other location (your local data), which means your local data will be deleted. There is no master or slave concept.
People apparently think that their local data is the master. But this concept would only work, if one used only one device.

4 Likes

I really think what DS-109 is after here is what is making most sense: If the sync target is empty, Joplin should move files there instead of deleting the local ones.

2 Likes

In that case we can’t call it sync anymore. This would be more like a one way sync with overwriting the target.

But then if you strictly follow this rule:

there's no way to set up sync because as soon as you add a target (which is presumably empty initially) you'll lose all your data.

Unless you read the documentation. The documentation states that this only happens when you change the sync target - not when you set it up.

So what to do when your backup fails and/or you lose data in your sync area, as happened to me (Fail-safe does not prevent deleted notes. Or: how to re-establish broken sync?)?

Since changing to an empty target deletes notes I wish for a possibilty to set up sync at any point in time. Could be a button named ‘restart sync’ or something like that. Then even if you lose data in the sync area or your backup fails, you still have the local database and can start over.

I'm very sorry, but then you lose your data. There's nothing anyone can do, when you don't have a proper backup.
That's almost the same as asking: What do I do, if I run out of gas and don't have a (full) fuel container in my trunk?

However, I think Laurent was playing with the idea of a Overwrite sync target button, but decided against it because it has consequences that most people will then put on Laurent: It will entail losing all data at the target and most likely sync erors/conflicts on other devices. It's like doing a forced push on a git repo with rewriting history.

This may be an obvious and useless suggestion to many, the workaround I used was to simply export my data, turn off the fail-safe, synchronize (and lose all my data), import my backup, re-synchronize (which uploads your backed up data to the empty directory). Don’t forget to turn the fail-safe back on to protect yourself. I was having trouble syncing to my NextCloud server, because I set up my folders incorrectly during the initial sync.

Of course, this only works if you haven’t yet lost your data. As tessus said, if you’ve already lost your data, then it seems to be that you’re out of luck.

3 Likes

I ran into this problem as well. I had to change my nextcloud, I simply couldn’t access the previous sync target anymore.

So I set up a new nextcloud, wanted to sync the joplin app to the new target and - after deleting some of my notes, the “failsafe” mechanism kicked in. (Hey guys, this isn’t failsafe, this is “stop failing early”!)

After reading the docs and some of the discussion here, I understand:

  • Syncing is not exporting and vice versa.
  • When you use joplin the wrong way, you lose (some) data without (previous) warning.
  • When you change to a new, empty sync target Joplin seems to think that you want to scrap your gazillion notes from the last fifteen years and start from scratch.
  • When you want to change your sync target to a new one and keep your notes you have to:
    • read the docs thoroughly,
    • make a backup,
    • export your notes to a .jex file,
    • have your old sync target ready,
    • somehow manage to copy all your joplin files with the cryptic names to this new platform, which you didn’t have time to get to know yet,
    • don’t forget this one important hidden directory,
    • make another backup, just in case,
    • make a backup of that .jex-file,
    • change the Sync-URL,
    • cross fingers,

I’m sure, this is not the user experience that we are aiming for. So I suggest to deal with the changing of the sync target not as a technical detail but as an important use case. These are my suggestions:

  • The “Synchronization” tab should just show the sync target, URL and username as string, and show an edit button, that changes the appearance to an edit dialog.
  • When the new values are saved, the app should probe the new target. Then it should present something like this:
    On the Synchronization target there are <xxx> notes (with 
    <xx> ressources in <x> notebooks etc.)
    On this device there are <yyy> notes (…)

    Actions:
    [Export local data to server (deleting <xxx> notes on server)]
    [Import remote data from server (deleting <yyy> local notes)]
    [Sync newest versions of notes to/from server without deleting anything]
    [Abort, restore previous sync target if any]
  • Delete this embarassing paragraph “All my notes got deleted after changing the WebDAV URL!” from the FAQ. A note taking app should never ever lose my data!

Fortunately in my case no data were lost. I have backups.

4 Likes

Not useless at all, but rather the most useful suggestion here for common folks.

Unfortunately, Joplin has not implemented the common sense suggestion by Johannes (27 Aug 2020) after two years. That's a pitty. I also find it odd that techies here seem to think that syncing existing notes with an empty directory means erasing the notes rather than merging both sources. (Esp. when it's the first sync.)

There should at the very least be a warning saying something like: the newer version of your notes contains 0 note(s), are you sure you want to delete the 1693 older notes that you painstainkingly crafted for the last 8 years, or merge them??

That's what I call proper syncing - am I wrong?

1 Like

Oh and by the way, there is no export feature in iOS/Android, so even the workaround doesn't work if you have data there that hasn't been sync'ed yet!

1 Like

Another way to go about it would be to use Susaya's workaround on another computer or another account on your main computer.

So you would install Joplin there, sync it with a temporary folder for the specific mobile device you're using, then use file|export|JEX function, then go to your main computer or account and there import.

Yes, there is no export feature. I lost my Nextcloud remote, so I’m starting on an empty directory, but I changed the sync target from nextcloud to webdaw and it seems to continue syncing again