Which version is renamed on conflict?

For the first time I encountered a “bigger-scale” conflict mess. I have no clue how it happened, but I am rather certain it was some weirdness on my system and not syncthing. Anyway, the solution would be simple: Just keep the “local” files and remove the “remote” files on my main working client (I did not do any changes purposely anywhere else). However I am not sure which version gets renamed.

The FAQ about this says that rather arbitrarily the version from the device with a “larger ID value” is marked (renamed?) as the conflicting one. Looking at rwfolder.go I do not find such a criterion and I think that always the local file gets renamed on conflict. What does actually happen?

If the FAQ is correct, can this be changed such that always the incoming or local (either would be fine) is renamed?

1 Like

The FAQ is probably a little bit outdated. The real sequence of decisions is:

  • Is one side deleted and the other one not? The not deleted side wins the conflict, preserving the file data.
  • Does one side have a newer modification time than the other? That one wins the conflict.
  • Finally, use the device ID as tie breaker.

(The actual code is here. The local-file-gets-renamed path is only taken one the device that loses the conflict.)

Thanks for the info. For clarification: In the case where one side of the conflict is deleted, the modification wins. But as there is just one version, there is no renaming to “sync-conflict”, but the modified file is put in place with the “original” filename (so the conflict is “invisible”)?

I will do an update on the FAQ, unless @calmh already did it?

Correct, the conflict is only visible as a “resurrection” on the side that had previously deleted the file.

Please do update the FAQ :slight_smile:

done: https://github.com/syncthing/docs/pull/241

What is the reason for using the device ID tie-breaking mechanism? Of course this event is unlikely, but if this happens it is not obvious which one got renamed. Always choosing the remote or local one would be arbitrary as well, but could just be looked up in the documentation.

When you have five devices, “remote” and “local” does not mean the same thing on all of them. We want this to be deterministic, or we’d generate new conflicts from the result of the conflict resolutions.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.