Re: shared-memory based stats collector - v70 - Mailing list pgsql-hackers

From Anton A. Melnikov
Subject Re: shared-memory based stats collector - v70
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: shared-memory based stats collector - v70  (Andres Freund <[email protected]>)
Responses Re: shared-memory based stats collector - v70
List pgsql-hackers
On 03.12.2024 18:07, Andres Freund wrote:
> Hi,
> 
> On 2024-12-03 13:37:48 +0300, Anton A. Melnikov wrote:
>> Found a place in the code of this patch that is unclear to me:
>>
https://github.com/postgres/postgres/blob/1acf10549e64c6a52ced570d712fcba1a2f5d1ec/src/backend/utils/activity/pgstat.c#L1658
>>
>> Owing assert() the next if() should never be performed, but the comment above says the opposite.
>> Is this assert really needed here? And if so, for what?
> 
> It's code that should be unreachable. But in case it is encountered in a
> production scenario, it's not worth taking down the server for it.

Thanks! It's clear.
Although there is a test case that lead to this assertion to be triggered.
But i doubt if anything needs to be fixed.
I described this case in as it seems to me suitable thread:
https://www.postgresql.org/message-id/56bf8ff9-dd8c-47b2-872a-748ede82af99%40postgrespro.ru

Would be appreciate if you take a look on it.


With the best wishes,

-- 
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: Memory leak in WAL sender with pgoutput (v10~)
Next
From: Andres Freund
Date:
Subject: Re: Remove remnants of "snapshot too old"