Hi, On 2021-05-06 15:27:29 -0400, Tom Lane wrote: > Andres Freund <and...@anarazel.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