Re: Fix locking issue with fixed-size stats template in injection_points

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix locking issue with fixed-size stats template in injection_points
Date: 2025-09-29 06:52:31
Message-ID: aNosr8ntXePfFlSF@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Sep 29, 2025 at 09:48:44AM +0900, Michael Paquier wrote:
> Then something like the following command:
> $ cat create_inj.sql
> \set id random(1,100000)
> select injection_points_attach('popo:id', 'notice');
> select injection_points_run('popo:id');
> select injection_points_detach('popo:id');
> $ pgbench -n -T 300 -f create_inj.sql -c 10
>
> The failure is not surprising, because the stats reports can happen in
> a concurrent fashion when a point is run for example, contrary to
> other fixed-sized stats kind where the reports are only done by a
> single process (archiver, bgwriter, checkpointer). So this is just a
> matter of acquiring a lock that was forgotten, to make sure that the
> changes are consistent. Far from critical as this is template code,
> still embarrassing.
>
> Thoughts or comments?

Patch LGTM.

Remark: I like the "popo" prefix in your test ;-)

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-09-29 06:57:18 Re: Changing shared_buffers without restart
Previous Message Ashutosh Bapat 2025-09-29 06:51:08 Re: Changing shared_buffers without restart