pgsql: Add tests for lock statistics, take two
| От | Michael Paquier |
|---|---|
| Тема | pgsql: Add tests for lock statistics, take two |
| Дата | |
| Msg-id | E1w9XGe-0039Kk-2I@gemulon.postgresql.org обсуждение |
| Список | pgsql-committers |
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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/557a9f1e3e62894cc3302eda72d9df091d72f37b Modified Files -------------- src/backend/storage/lmgr/proc.c | 2 + src/test/modules/test_misc/meson.build | 1 + src/test/modules/test_misc/t/011_lock_stats.pl | 251 +++++++++++++++++++++++++ 3 files changed, 254 insertions(+)
В списке pgsql-committers по дате отправления: