Re: Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath
Дата
Msg-id aPBJmY5hHddBDIdn@paquier.xyz
обсуждение исходный текст
Ответ на Re: Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath  (Kevin K Biju <kevinkbiju@gmail.com>)
Список pgsql-hackers
On Wed, Oct 15, 2025 at 07:30:39PM +0530, Kevin K Biju wrote:
> Thanks for the context. I missed the earlier discussions about the same
> issue. Using unlink in the error paths makes sense to me. There is an edge
> case in my mind, in case unlink fails as well, and we end up in the same
> condition; however, the chance of that occurring is sufficiently low.

My suspicion is that an unlink() failure would link to much more
problems, including what could be crashes in critical sections.  That
would mean a crash, where the state.tmp file would get cleaned up by
recovery.  What we have now in the tree should be (I hope!) a good
balance.

That was 6 years ago, and it is very easy to miss, so no worries.
Even in my case, I've recalled the previous discussion after one night
of sleep, only because I've participated in it and because the
automated truncation you have suggested was itching me.  Somewhat.

> Thanks for the quick response!

No problem.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления: