Re: use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 盏一 <w(at)hidva(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`
Date: 2021-05-06 19:45:20
Message-ID: 20210506194520.fbkiva75z7mwzkzq@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2021-05-06 15:27:29 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > If you do, I think it might be worthwhile to add an only-with-assertions
> > loop checking that there's no other entry with the same pgprocno in the
> > dense arrays.
>
> Hmm, I can definitely see keeping a check that the selected entry
> has the right PID and/or pgprocno, but making it search for duplicates
> seems a bit over the top. The existing code isn't guarding against
> that, and I don't really see a reason why there's a meaningful risk
> of it.

The current code makes it at least more likely for things to fall over
badly if there's such an issue, because there's a 50/50 chance that the
wrong entry would be moved. I do dimly remember hitting a nasty bug or
two during the development of 941697c3c where such a thing happened, but
I don't remember the details.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-05-06 19:49:15 Re: Printing backtrace of postgres processes
Previous Message Andres Freund 2021-05-06 19:32:29 Re: [BUG]"FailedAssertion" reported in lazy_scan_heap() when running logical replication