From: | Kevin K Biju <kevinkbiju(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath |
Date: | 2025-09-30 11:51:05 |
Message-ID: | CAM45KeHa32soKL_G8Vk38CWvTBeOOXcsxAPAs7Jt7yPRf2mbVA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
We have encountered a few instances where logical replication errors out
during SaveSlotToPath() after creating the state.tmp file, but before it
was renamed (due to ENOSPC, for example). In these cases, since state.tmp
is not cleaned up and is created with the O_EXCL flag, further invocations
of SaveSlotToPath() for this slot will error out on OpenTransientFile()
with EEXIST, completely blocking slot metadata persistence. The only
explicit cleanup for state.tmp occurs during server startup as part of
RestoreSlotFromDisk().
It doesn't seem that this function relies on data written to state.tmp
previously, so O_EXCL is unnecessary. Attaching a patch that swaps O_EXCL
for O_TRUNC, ensuring a fresh state.tmp is available for writing.
Thanks,
Kevin
Attachment | Content-Type | Size |
---|---|---|
replslot_state_tmp_otrunc.patch | application/octet-stream | 532 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Dilip Kumar | 2025-09-30 12:01:46 | Re: pgstattuple "unexpected zero page" for gist and hash indexes |
Previous Message | Álvaro Herrera | 2025-09-30 11:44:00 | Re: anonymous unions (C11) |