| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Daniil Davydov <3danissimo(at)gmail(dot)com> |
| Cc: | Alexander Korotkov <aekorotkov(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: | 2025-10-31 20:03:14 |
| Message-ID: | CAD21AoA0bnRZC_OqKMnH-Ln+OZ9z9k56j2c_MXj8pw69O-wkBw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 28, 2025 at 6:10 AM Daniil Davydov <3danissimo(at)gmail(dot)com> wrote:
>
> >
> > IIUC the patch still has one problem in terms of reloading the
> > configuration parameters during parallel mode as I mentioned
> > before[1].
> >
>
> Yep. I was happy to see that you think that config file processing is OK for
> autovacuum :)
> I'll allow it for a/v leader. I've also thought about "compute_parallel_delay".
> The simplest solution that I see is to move cost-based delay parameters to
> shared state (PVShared) and create some variables such a
> VacuumSharedCostBalance, so we can use them inside vacuum_delay_point.
> What do you think about this idea?
I think that we need to somehow have parallel workers use the new
vacuum delay parameters (e.g., VacuumCostPageHit and
VacuumCostPageMiss) after the leader reloads the configuration file.
The leader shares the initial parameters with the parallel workers
(via DSM) before starting the workers but doesn't propagate the
updates during the parallel operations. And the worker doesn't reload
the configuration file.
>
> Another approaches like a "tell parallel workers that they should
> reload config"
> looks a bit too invasive IMO.
>
>
> Thanks everybody for the review! Please, see v12 patches :
> 1) Implement tests for parallel autovacuum
> 2) Fix error with unreleased workers - see try/catch block in do_autovacuum
> and before_shmem_exit callback registration in AutoVacWorkerMain
> 3) Allow a/v leader to process config file (see guc.c)
>
Here are some review comments for 0001 patch:
+static void
+autovacuum_worker_before_shmem_exit(int code, Datum arg)
+{
+ if (code != 0)
+ AutoVacuumReleaseAllParallelWorkers();
+}
+
AutoVacuumReleaseAllParallelWorkers() calls
AutoVacuumReleaseParallelWorkers() only when av_nworkers_reserved > 0,
so I think we don't need the condition 'if (code != 0)' here.
---
+extern void AutoVacuumReleaseAllParallelWorkers(void);
There is no caller of this function outside of autovacuum.h.
---
{ name => 'autovacuum_max_parallel_workers', type => 'int', context =>
'PGC_SIGHUP', group => 'VACUUM_AUTOVACUUM',
short_desc => 'Maximum number of parallel autovacuum workers, that
can be taken from bgworkers pool.',
long_desc => 'This parameter is capped by "max_worker_processes"
(not by "autovacuum_max_workers"!).',
variable => 'autovacuum_max_parallel_workers',
boot_val => '0',
min => '0',
max => 'MAX_BACKENDS',
},
Parallel vacuum in autovacuum can be used only when users set the
autovacuum_parallel_workers storage parameter. How about using the
default value 2 for autovacuum_max_parallel_workers GUC parameter?
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryan Green | 2025-10-31 20:07:18 | Re: [PATCH] Add Windows support for backtrace_functions (MSVC only) |
| Previous Message | Jeff Davis | 2025-10-31 19:59:20 | Re: Remaining dependency on setlocale() |