Hi Andrey,
Thanks for the review!
> distinguish the leader from its workers. Perhaps a comment at the
> macro definition noting that autovacuum's parallel workers return
> false would help prevent similar mistakes.
Attached is v2 with the comment you suggested for
AmAutoVacuumWorkerProcess().
> Could we cover the parallel-worker path with a test? One possible
> scenario is to pause cleanup while flushing the old tail into the main
> index, append new pending pages, and verify that cleanup leaves those
> new pages behind. The test would need to ensure that a parallel worker,
> not the leader, handles the index; otherwise it could pass without
> the fix. I have not tried this scenario yet.
For the test, I haven't found a reliable way to control the timing
without adding injection points. We need to ensure that a parallel
worker handles the index, and append new pending pages while cleanup
is flushing the old tail into the main index.
Do you have any ideas for a simpler way to test this?
---
Best regards,
Jingtang Zhang