Re: POC: Parallel processing of indexes in autovacuum

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Sami Imseih <samimseih(at)gmail(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: POC: Parallel processing of indexes in autovacuum
Date: 2026-04-02 15:10:46
Message-ID: CAJDiXgh0py4DcbJOW5VaCeHtyofFSAaR2Mx3BhyJHppG15Lr3g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Apr 2, 2026 at 6:16 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Thank you for updating the patch! I found a bug in the following code:
>
> @@ -457,6 +534,9 @@ parallel_vacuum_end(ParallelVacuumState *pvs,
> IndexBulkDeleteResult **istats)
> DestroyParallelContext(pvs->pcxt);
> ExitParallelMode();
>
> + if (AmAutoVacuumWorkerProcess())
> + pv_shared_cost_params = NULL;
> +
>
> If an autovacuum worker raises an error during parallel vacuum, it
> doesn't pv_shared_cost_params. Then, if it doesn't use parallel vacuum
> on the next table to vacuum, it would end up with SEGV as it attempts
> to propagate the vacuum delay parameters.

Ouch. Indeed, I did not foresee this.
Thank you for noticing it!

I think we should add some cleanup for autovacuum near the ParallelContext
cleanup, since they are interconnected. I also want to return our tests that
are triggering ERROR/PANIC in the leader worker in order to check whether all
resources are released. I hope I will be able to get to that by tomorrow
evening.

--
Best regards,
Daniil Davydov

Attachment Content-Type Size
0001-Make-sure-that-all-recourses-have-been-released-in-p.patch text/x-patch 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-04-02 15:47:39 Re: AIO / read stream heuristics adjustments for index prefetching
Previous Message Tomas Vondra 2026-04-02 15:05:34 Re: EXPLAIN: showing ReadStream / prefetch stats