> The root cause seems to me that it's not guaranteed that we can see
> the autovacuum logs after checking the statistics (i.e.,
> pg_stat_user_tables) as we update the statistics and then write the
> log.
>
> One way to fix the test is to replace log_contains() with
> wait_for_log(). We can also remove wait_for_autovacuum_complete()
> logic altogether.
+1. I was going to reply with exactly this. Attached is the fix.
--
Sami