On Thu, Apr 14, 2022 at 10:32 AM Imseih (AWS), Sami <sims...@amazon.com> wrote: > > Taking the above feedback, I modified the patches > and I believe this approach should be acceptable. > > For now, I also reduced the scope to only exposing > Indexes_total and indexes_completed in > pg_stat_progress_vacuum. I will create a new CF entry > for the new view pg_stat_progress_vacuum_index. > > V10-0001: This patch adds a callback to ParallelContext > that could be called by the leader in vacuumparallel.c > and more importantly while the leader is waiting > for the parallel workers to complete inside.
Thank you for updating the patch! The new design looks much better to me. typedef struct ParallelWorkerInfo @@ -46,6 +49,8 @@ typedef struct ParallelContext ParallelWorkerInfo *worker; int nknown_attached_workers; bool *known_attached_workers; + ParallelProgressCallback parallel_progress_callback; + void *parallel_progress_callback_arg; } ParallelContext; I think we can pass the progress update function to WaitForParallelWorkersToFinish(), which seems simpler. And we can call the function after updating the index status to PARALLEL_INDVAC_STATUS_COMPLETED. BTW, currently we don't need a lock for touching index status since each worker touches different indexes. But after this patch, the leader will touch all index status, do we need a lock for that? Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/