Intermittent nodes and resurrected stale files

I have three Linux laptops and one Android phone which are all almost always on and syncing. Occasionally a laptop will be suspended for travel, or rebooted after upgrading software. The phone sometimes gets out of any service area, and also gets upgraded once in a while. No problems with any of this, Syncthing just picks up where it left off, all is fine.

I also have an ancient Mac laptop which I used for travel because a former employer had Mac company laptops. I don’t use it much any more. Generally it stays powered off. Once a month I recharge the battery and power it back up to resync, for no particular reason, sometimes it will be two months. It generally resyncs fine.

The most recent Mac resync got confused however. It resurrected several directories which had been deleted a month or two before, but after its previous resync. No harm done. No other files had been updated or deleted by mistake. I keep a master copy of the sync repository in an area which Syncthing doesn’t know about, mostly manually updated, and have a nightly cron job which compares the two.

No complaints about Syncthing doing this, But it made me curious. How old does a change have to be before Syncthing forgets about it? Here I had deleted some directories probably 45 days earlier, and the three Linux laptops and the Android phone seemed to have forgotten the directories ever existed, so when the Mac resynced, it’s as if the other node thought those directories were new and added them back.

Please understand, I am not complaining :slight_smile: and I don’t pretend to know what really happened; I only say the active nodes seem to have forgotten about deleting those directories, the Mac node presented them as new, and I am curious about how long Syncthing remembers old deletes. I may well be wrong about this. An alternative possibility is that the last time I recharged and powered up the Mac, it had no internet connectivity, and that reset some internal status which the next reconnect interpreted incorrectly. I am sure there are other possibilities.

I am just curious. I thought it actually kind of funny, and it made me wonder how much longer there will be any point in keeping the old Mac running. I haven’t used it for travel in probably 5 years,

There is no “forgetting”.

If you get a set of computers running syncthing in sync, then disconnect one of them from the rest, then delete some files in the connected group, and modify the same files on the disconnected device, it doesn’t matter how much time will pass, syncthing will reintroduce the files that were deleted, because modifications wins over deletions, regardless of how old the modifications are relative to the deletions.

The files were not modified on the intermittent node. The sequence was:

All connected. Directories all distributed and in sync. Mac disconnected for 45 days, more or less. Several directories were deleted on the remaining active syncthing nodes. Mac powered back up and reconnected to syncthing net. No changes were made on the Mac to any syncthing files. The deleted directories still existed on the Mac, and were apparently resurrected and distributed to the other nodes.

Directories are cheap, so we resurrect them if we need to, but we only do that if some file in one of the directories have changed.

You say nothing has modified the files, but this whole thing only happens when files are modified, so it must have been modified.

And I am not saying the content has changed, modification timestamp changing would be enough.

Also, you might have not changed it, but operating systems have various indexers running in the background, which might update file metadata as part of its process.

Was there a daylight savings time switch in between by any chance? It’s complicated what happens to file modification times in such cases.

That’s an interesting question. Not sure. The recent sync was a week or so ago (normally it happens on the first of the month, but there was 11 days without power around then), and I had skipped December 1st. My guess is the previous sync was beginning of November, and daylight savings switches after Hallowe’en, something like first Sunday in November.

So maybe so, maybe not.

Screw DST, seriously! Twice, in case it turns out to be the root cause here :rofl:

Let me get back to my original question, since this is mostly curiosity rather than a real problem. Suppose a computer is in sync with a small network, and then goes offline for a year. Meanwhile, the day after going off line, the remaining network deletes a file. A year later, that intermittent node comes back online and shows that deleted file. How do the other nodes know it’s not a new file? It seems unlikely to me (as an observer, a bystander, a user) for the other nodes to keep track of all changes since the beginning. At some point, surely they flush their history, and thus when the intermittent comes back online and shows the old file, they all think it is a new file.

So my question comes down to — what kind of change history is maintained, and are old entries erased after some time, or does it just grow forever? That does lead to a further question of whether each node has an independent change history, or whether all nodes sync their change histories too? Or maybe all this is handled some other way, and I am just imagining something which doesn’t exist.

It grows forever.

But history for a given file is just a number per device that keeps increasing,