How does deletion work in Syncthing

Hi Syncthing peeps,

Can someone explain how deletion works in Syncthing, especially w/regards to multiple devices? Specifically, I seek to understand what Syncthing does when a file deletion occurs while another device is down. Example:

  • Node A, up, deletes file
  • Node B, also up, gets delete notification from A, deletes file also
  • Node C, down, does nothing

My question is specifically: when node C comes back up, how does it know to also delete the file? Could there be a condition where node A and B actually re-obtain the previously deleted file from node C in such a case?

Much thanks in advance for thorough explanation and/or pointers to docs explaining this!

The docs explain how sync it tracked and how conflicts are resolved.

https://docs.syncthing.net/users/syncing.html#id2

In your case, if the file is indexed (known about), and unchanged before C reconnects it will be deleted.

If the file is changed at all while disconnected (even if the change predates the delete on the other devices) it will be considered a conflict and synced to A and B. Existing files always win the conflict with a delete.

1 Like

Alright, that makes sense. Regarding:

How can such a situation happen? Do you mean: the disconnected device has a file change, whilst being disconnected, the index picked up on that, then further along in time, whilst still being disconnected, the other hosts delete the file, then finally host C rejoins → AHA, a change that the others never saw → re-instate file?

Yes