Re: POC: Cleaning up orphaned files using undo logs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POC: Cleaning up orphaned files using undo logs
Date: 2019-05-06 15:29:10
Message-ID: CA+Tgmob6d4OXYkpR=1YTEPtoKiPqHQDw2iwEFqz4PMAP4y3v7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 6, 2019 at 8:13 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> > In general, I find the code for updating transaction headers to be
> > really hard to understand. I'm not sure exactly what can be done
> > about that. Like, why is UndoRecordPrepareTransInfo unpacking undo?
>
> It's only unpacking header. But, yeah we can do better, instead of
> unpacking we can just read the main header and from uur_info we can
> calculate exact offset of the uur_next and in
> UndoRecordUpdateTransInfo we can directly update only uur_next by
> writing at that offset, instead of overwriting the complete header?

Hmm. I think it's reasonable to use the unpack infrastructure to
figure out where uur_next is. I don't know whether a bespoke method
of figuring that out would be any better. At least the comments
probably need some work.

> > Why does it take two undo record pointers as arguments and how are
> > they different?
> One is previous transaction's start header which we wants to update
> and other is current transaction's urec pointer what we want to set as
> uur_next in the previous transaction's start header.

So put some comments.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2019-05-06 15:31:17 Re: reindexdb & clusterdb broken against pre-7.3 servers
Previous Message Andres Freund 2019-05-06 15:27:32 Re: Unhappy about API changes in the no-fsm-for-small-rels patch