postgres-github.git / summary / log / commit / refs

commit    557a9f1e3e62894cc3302eda72d9df091d72f37b
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Sun Apr 05 23:51:30 2026 +0000

    Add tests for lock statistics, take two
    
    Commit 7c64d56fd976 has removed the isolation test providing coverage
    for lock statistics due to some instability in the CI, where the
    deadlock timeout may not have enough time to process, preventing the
    stats data to be updated.  These also relied on a set of hardcoded
    sleeps.
    
    This commit switches the test suite to TAP, instead, that uses an
    injection point with a wait to avoid the sleeps.  The injection point is
    added in ProcSleep(), once we know that the deadlock timeout has fired
    and that the stats have been updated.
    
    Multiple lock patterns are checked, all rely on the same workflow, with
    two sessions:
    - session 1 holds a given lock type.
    - session 2 attaches to the new injection point with the wait action.
    - session 2 attempts to acquire a lock conflicting with the lock of
    session 1, waiting for the injection point to be reached.
    - session 1 releases its lock, session 2 commits.
    - pg_stat_lock is polled until the counters are updated for the lock
    type.
    
    Bertrand's version of the patch introduced a new routine to
    BackgroundPsql() to detect the blocked background sessions.  I have
    tweaked the test so as we use the same method as some of the other tests
    instead, based on some \echo commands.  This test has been run multiple
    times in the CI, all passing, so I'd like to think that this is more
    stable than the first version attempted.
    
    Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
    Co-authored-by: Michael Paquier <michael@paquier.xyz>
    Discussion: https://postgr.es/m/acNTR1lLHwQJ0o+P@ip-10-97-1-34.eu-west-3.compute.internal

[parent: 9b5acad3f40f]