Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- I think there is an important typo:
> what happens if other processes had open file descriptors pointing to new
Should end with “old”, not “new”.
by zbentley - Shouldn't this return errors to the "other processes [that] had open file descriptors pointing to new" ?by euroderf
- Yes, handle statefulness is very important.
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
by zbentley