pgsql: Fix injection point detach timing problem in TAP test for lock s - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Fix injection point detach timing problem in TAP test for lock s
Date
Msg-id E1w9xud-003KrO-0e@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix injection point detach timing problem in TAP test for lock stats

injection_points_detach() could fail because of a concurrent cleanup
triggered by injection_points_set_local() when a session finishes.
This problem could be reproduced by adding a hardcoded sleep in
InjectionPointDetach(), and has been detected by the CI.

As the test is designed so as the injection point is detached before
being awaken, there is no need for it to be local, similarly to test
010_index_concurrently_upsert.  This commit removes
injection_points_set_local(), replacing it with a confirmation that the
point has been attached in the session expected to block on a lock.
With this removal, the detach cannot happen concurrently anymore, only
before when the point is woken up.

Issue introduced by 557a9f1e3e62, where the test has been added.

Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/rp6wz4lnz5qn4zlh7uxtavzfrmqvycy2g42z4zasfss2gxi54f@zzcsjdvdflwp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3284e3f63cf0b42a1c89bb547778754d72aac9e4

Modified Files
--------------
src/test/modules/test_misc/t/011_lock_stats.pl | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Fix shmem allocation of fixed-sized custom stats kind
Next
From: John Naylor
Date:
Subject: pgsql: Split CREATE STATISTICS error reasons out into errdetails