pgsql: Fix unstable log verification in test_autovacuum.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix unstable log verification in test_autovacuum.
Date: 2026-04-10 23:02:13
Message-ID: E1wBKrc-000N44-21@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix unstable log verification in test_autovacuum.

The test in test_autovacuum was unstable because it called
log_contains() immediately after verifying autovacuum_count in
pg_stat_user_tables. This created a race condition where the
statistics could be updated before the autovacuum logs were fully
flushed to disk.

This commit replaces log_contains() with wait_for_log() to ensure the
test waits for the parallel vacuum messages to appear. Additionally,
remove the checks of the autovacuum count. Verifying the log messages
is sufficient to confirm parallel autovacuum behavior, as logging is
only enabled for the specific table under test.

Per report from buildfarm member flaviventris.

Author: Sami Imseih <samimseih(at)gmail(dot)com>
Discussion: https://postgr.es/m/525d0f48-93f7-493f-a988-f39b460a79bc@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c22d115f1d13d7c1b89ec20abaa02ebeb811b9dd

Modified Files
--------------
.../test_autovacuum/t/001_parallel_autovacuum.pl | 40 +++++++---------------
1 file changed, 12 insertions(+), 28 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2026-04-10 23:36:12 pgsql: read_stream: Remove obsolete comment.
Previous Message Masahiko Sawada 2026-04-10 19:50:04 Re: pgsql: Allow autovacuum to use parallel vacuum workers.