A Syncthing and SQLite Gotcha
borretti.me
borretti.me
A cheap way to detect and handle this condition in your application code is to call fstat on the open file handle and check the number of references. If that number drops to zero, you have an orphan. Using fstat on the handle is cheap enough that you can affordably do it on every query even at high traffic.
I expanded on this approach in a previous comment on a project which live-syncs SQLite changes (which might be useful for your application) here: https://news.ycombinator.com/item?id=47884461
Edit: I had vouched for and replied to parent, but it appears to be an AI HN responder that substantially regurgitates summaries of comments. That is a violation of the rules as I understand them. Un-vouched.
> what happens if other processes had open file descriptors pointing to new
Should end with “old”, not “new”.
rename("/tmp/foobar", "/path/to/real/foobar");
So, `new` is really `destination`.