Re: AssertLog instead of Assert in some places

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: AssertLog instead of Assert in some places
Дата
Msg-id 20230811175723.gyxxryi5u6xc44zq@awork3.anarazel.de
обсуждение исходный текст
Ответ на AssertLog instead of Assert in some places  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Ответы Re: AssertLog instead of Assert in some places  (Peter Geoghegan <pg@bowt.ie>)
Re: AssertLog instead of Assert in some places  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Список pgsql-hackers
Hi,

On 2023-08-11 17:59:37 +0530, Ashutosh Bapat wrote:
> Most of the Asserts are recoverable by rolling back the transaction
> without crashing the backend. So an elog(ERROR, ) is enough. But just
> by themselves elogs are compiled into non-debug binary and the
> condition check can waste CPU cycles esp. conditions are mostly true
> like the ones we use in Assert.
> 
> Attached patch combines Assert and elog(ERROR, ) so that when an
> Assert is triggered in assert-enabled binary, it will throw an error
> while keeping the backend intact. Thus it does not affect gdb session
> or psql session. These elogs do not make their way to non-assert
> binary so do not make it to production like Assert.

I am quite strongly against this. This will lead to assertions being hit in
tests without that being noticed, e.g. because they happen in a background
process that just restarts.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: walsender "wakeup storm" on PG16, likely because of bc971f4025c (Optimize walsender wake up logic using condition variables)
Следующее
От: Marcelo Juchem
Дата:
Сообщение: Re: [PATCH] Support static linking against LLVM