A couple of questions on how sync works

Hi everyone, sorry for the “combined” message, but I have a couple of unrelated questions:

  1. suppose I have 3 machines: A and B share a folder, B and C share the same folder. The reason for this is that B is a sort of gateway, and A doesn’t need to know about who’s behind B (e.g. C may be replaced by C2 at some point). But is there any practical difference between this topology and having all three machines share the folder? (e.g. sync speed, db size, etc)

  2. suppose A and B share a folder containing file F1. if I add another file F2 which is identical to F1 (except possibly for file date), will it be transferred fully or will Syncthing figure out all its blocks are “known” to the receiver?

thanks MH

  1. Yes, it’s slower to propagate (as it has to become available on B to be seen by A or C, speed as it can only fetch data from one peer, db size as it only has to manage state of one other peer rather than 2.

  2. It should not retransfer blocks it already has (in terms of sha256 hash), regardless of what file it’s for.

2 Likes

Thanks for the kind reply!

I’ll give you a bit more context: at the moment, we have two machines A and B that share two folders: MAIN (send only from A to B) and TEMP (bidirectional). When people want to add something to MAIN, they actually drop it in TEMP; periodically, someone manually validates the files and moves them somewhere in MAIN (on A). However this has a couple of inefficiencies:

  1. files are copied twice on the wire
  2. sometimes by mistake, a duplicate file is added to TEMP, e.g. a file that is already in MAIN. this is not a problem, because manual validation will always notice and delete it, but we may want to avoid transferring this file from B to A (hence my question about duplicates).

What we are considering now is to relax the permissions, share MAIN bidirectionally, and move TEMP to a subfolder of MAIN. While this is a bit “risky”, it’s likely to save (a lot of) bandwidth. Not sure if there’s a smarter way to achieve the same result.

MH

Blocks are reused between folders, so where the files land doesn’t matter.

It does matter if you move files from temp to main, as you effectively delete the file from temp, before it appears in main, so you end up with a retransfer.

Fantastic, I didn’t know blocks were reused “globally”.

So, probably the best option would be to leave current setup, COPY files from TEMP to MAIN and maybe periodically wipe TEMP?

I can’t tell you what’s best, it’s for you to decide. I am explaining how it works.