Re: pgbench: make verbose error messages thread-safe

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench: make verbose error messages thread-safe
Date: 2026-04-24 08:07:27
Message-ID: aeskvwWLrC6wwzDK@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 24, 2026 at 03:26:03PM +0900, Fujii Masao wrote:
> Attached patch fixes this issue by changing printVerboseErrorMessages()
> to use a local PQExpBufferData instead of a static one. Thoughts?

That looks like an oversight of 4a39f87acd6e to me. A static buffer
in this context is not adapted.

> Since this issue was introduced in v15, the patch should be
> backpatched to v15 if accepted.

This forces a new allocation for each message printed vs a set of
resets after one allocation is done. This change is not going to be
entirely free as done in the patch, so should we worry about that?
Perhaps it would be cheaper to allocate a PQExpBuffer in each CState,
and just reuse it in this routine?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Guo 2026-04-24 08:09:06 Re: pgbench: make verbose error messages thread-safe
Previous Message Peter Eisentraut 2026-04-24 07:52:34 Re: meson html:alias vs. html:custom