Re: Stack overflow issue - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Stack overflow issue
Date
Msg-id CA+TgmoYTfXGJMWDFRisKCEVBr07xsyecA6cNQTnti305MbcsDg@mail.gmail.com
Whole thread Raw
In response to Re: Stack overflow issue  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Stack overflow issue
List pgsql-hackers
On Fri, Jan 12, 2024 at 10:12 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> Here's one goto-free attempt. It adds a local loop to where the
> recursion was, so that if you have a chain of subtransactions that need
> to be aborted in CommitTransactionCommand, they are aborted iteratively.
> The TBLOCK_SUBCOMMIT case already had such a loop.
>
> I added a couple of comments in the patch marked with "REVIEWER NOTE",
> to explain why I changed some things. They are to be removed before
> committing.
>
> I'm not sure if this is better than a goto. In fact, even if we commit
> this, I think I'd still prefer to replace the remaining recursive calls
> with a goto. Recursion feels a weird to me, when we're unwinding the
> states from the stack as we go.

I'm not able to quickly verify whether this version is correct, but I
do think the code looks nicer this way.

I understand that's a question of opinion rather than fact, though.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Recovering from detoast-related catcache invalidations
Next
From: Jacob Burroughs
Date:
Subject: Re: libpq compression (part 3)