Re: Orphaned files in base/[oid]

From: Alexey Gordeev <goa(at)arenadata(dot)io>
To: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chris Travers <chris(dot)travers(at)adjust(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Orphaned files in base/[oid]
Date: 2023-05-12 09:45:42
Message-ID: 214401683884627@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<div><div><br /><div> </div><div>12.05.2023, 14:17, "Andres Freund" &lt;andres(at)anarazel(dot)de&gt;:</div><blockquote><p>Alternatively we could do something without marker files, with some<br />added complexity: Keep track of all "uncommitted new files" in memory,<br />and log them every checkpoint. Commit/abort records clear elements of<br />that list. Since we always start replay at the beginning of a<br />checkpoint, we'd always reach a moment with such an up2date list of<br />pending-action files before reaching end-of-recovery. At end-of-recovery<br />we can delete all unconfirmed files. To avoid out-of-memory due to too<br />many tracked relations, we'd possibly still have to have marker files...</p></blockquote><div><div><div><div><div><div><div>Hi, hackers.</div><div> </div><div>I'm sorry, but I want to bump this thread, because there is still no good solution to solve the problem. I see there are few threads with undo-based approaches, which looks preferable, but have some pitfalls. Is there any chance to return to non-undo approaches partially discussed here? What do you think about the following solutions?</div><div>1) Make `pendingDeletes` shared and let postmaster clean all garbage in case of child process dying. Cons: Not works in case of postmaster dying. Should care about `pendingDeletes` pointers validity.</div><div>2) Catch and store all records with relfilenode during WAL replay, delete all orphaned nodes at the end of replaying. Cons: The final delete may use an incomplete list of nodes, as there was something before the latest checkpoint. The general opacity - we remove something without a corresponded WAL record (or possibly do it in wrong place in general).</div><div>3) This way is close to one I quoted and a combination of two above. `pendingDeletes` is shared. Each checkpoint creates a WAL record with a list of open transactions and created nodes. WAL replaying can use this list as base, adding nodes to it from newer records. The final delete operation has a complete list of orphaned nodes. Cons: Complexity(?). Others(?). </div><div> </div><div>Can it work? Are any of this approaches still relevant?</div></div></div></div></div></div></div></div></div><div><span style="background-color:#ffffff;color:#0c2037;float:none;font-family:'epilogue';font-size:16px;font-style:normal;font-weight:400;text-align:left;text-decoration-color:initial;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">-- </span></div><div><span style="background-color:#ffffff;color:#0c2037;float:none;font-family:'epilogue';font-size:16px;font-style:normal;font-weight:400;text-align:left;text-decoration-color:initial;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Regards,</span></div><div><span style="background-color:#ffffff;color:#0c2037;float:none;font-family:'epilogue';font-size:16px;font-style:normal;font-weight:400;text-align:left;text-decoration-color:initial;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Alex Go, C developer<br /><a href="mailto:goa(at)arenadata(dot)io" rel="noopener noreferrer">goa(at)arenadata(dot)io</a>, www.arenadata.tech</span></div><div> </div>

Attachment Content-Type Size
unknown_filename text/html 3.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2023-05-12 09:58:31 RE: Non-superuser subscription owners
Previous Message torikoshia 2023-05-12 08:53:45 Re: Allow pg_archivecleanup to remove backup history files