On Thu, Dec 19, 2019 at 11:11 AM Masahiko Sawada <masahiko.saw...@2ndquadrant.com> wrote: > > On Wed, 18 Dec 2019 at 19:06, Amit Kapila <amit.kapil...@gmail.com> wrote: > > > > - /* Cap by the worker we computed at the beginning of parallel lazy vacuum */ > - nworkers = Min(nworkers, lps->pcxt->nworkers); > + /* > + * The number of workers required for parallel vacuum phase must be less > + * than the number of workers with which parallel context is initialized. > + */ > + Assert(lps->pcxt->nworkers >= nworkers); > > Regarding the above change in your patch I think we need to cap the > number of workers by lps->pcxt->nworkers because the computation of > the number of indexes based on lps->nindexes_paralle_XXX can be larger > than the number determined when creating the parallel context, for > example, when max_parallel_maintenance_workers is smaller than the > number of indexes that can be vacuumed in parallel at bulkdelete > phase. >
oh, right, but then probably, you can write a comment as this is not so obvious. > > > > Few other comments which I have not fixed: > > > > 4. > > + if (Irel[i]->rd_indam->amusemaintenanceworkmem) > > + nindexes_mwm++; > > + > > + /* Skip indexes that don't participate parallel index vacuum */ > > + if (vacoptions == VACUUM_OPTION_NO_PARALLEL || > > + RelationGetNumberOfBlocks(Irel[i]) < min_parallel_index_scan_size) > > + continue; > > > > Won't we need to worry about the number of indexes that uses > > maintenance_work_mem only for indexes that can participate in a > > parallel vacuum? If so, the above checks need to be reversed. > > You're right. Fixed. > > > > > 5. > > /* > > + * Remember indexes that can participate parallel index vacuum and use > > + * it for index statistics initialization on DSM because the index > > + * size can get bigger during vacuum. > > + */ > > + can_parallel_vacuum[i] = true; > > > > I am not able to understand the second part of the comment ("because > > the index size can get bigger during vacuum."). What is its > > relevance? > > I meant that the indexes can be begger even during vacuum. So we need > to check the size of indexes and determine participations of parallel > index vacuum at one place. > Okay, but that doesn't go with the earlier part of the comment. We can either remove it or explain it a bit more. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com