| From: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> |
| Subject: | Re: Orphaned Files in PostgreSQL |
| Date: | 2026-09-23 11:18:25 |
| Message-ID: | CAE9k0P=BcbT-Z5m+qy-0qhf92CEtTs6nYg5OE=9oLJOAvz2yrg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Fri, Aug 21, 2026 at 12:25 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Thu, Aug 20, 2026 at 02:40:25PM +0530, Ashutosh Sharma wrote:
> > Hi All,
> >
> > I am revisiting this thread to propose a possible fix for this known issue.
>
> Thanks for working on this!
>
> > This ordering guarantees that relation storage cannot become durable
> > without either a durable marker or WAL capable of reconstructing that
> > marker.
>
> I wonder if logging XLOG_SMGR_CREATE before smgrcreate() could interact badly
> with a concurrent checkpoint? I looked at [1] and it looks like it used a separate
> PRECREATE record and kept the usual CREATE record after physical creation.
>
This has been addressed in the attached patch.
The patch also replaces the earlier design of creating one marker file
per relation file with a manifest file per transaction XID. Each
manifest records the durable relations created by that transaction.
On transaction completion, the corresponding manifests are retired and
removed. If PostgreSQL crashes before transaction cleanup completes,
recovery examines the remaining manifests after WAL replay. Manifests
belonging to committed or prepared transactions are preserved or
cleaned up appropriately, while relation files recorded for aborted or
incomplete transactions are removed. The processed manifests are then
removed.
The patch also handles subtransactions, prepared transactions, standby
replay, truncated manifests, and failures that leave retired manifests
behind.
Please take a look and let me know.
--
With Regards,
Ashutosh Sharma.
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Remove-relation-files-left-by-crash-aborted-transact.patch | application/octet-stream | 40.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-09-23 11:22:48 | Re: SSI: ON CONFLICT DO SELECT takes no predicate lock on the returned row |
| Previous Message | John Naylor | 2026-09-23 11:17:47 | Re: [PATCH] Refactor *_abbrev_convert() functions |