diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index d2c895a6fb..bf5873edb1 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -2939,7 +2939,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, /* * Compute the number of parallel worker processes to request. Both index * vacuum and index cleanup can be executed with parallel workers. The - * relation size of the table don't affect the parallel degree for now. + * relation size of the table doesn't affect the parallel degree for now. * * nrequested is the number of parallel workers that user requested. If * nrequested is 0, we compute the parallel degree based on nindexes, that is @@ -3365,6 +3365,7 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc) VacuumPageHit = 0; VacuumPageMiss = 0; VacuumPageDirty = 0; + VacuumCostBalanceLocal = 0; VacuumSharedCostBalance = &(lvshared->cost_balance); VacuumActiveNWorkers = &(lvshared->active_nworkers); diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 1cd77e79d2..c645d4463f 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -435,7 +435,9 @@ vacuum(List *relations, VacuumParams *params, VacuumPageHit = 0; VacuumPageMiss = 0; VacuumPageDirty = 0; + VacuumCostBalanceLocal = 0; VacuumSharedCostBalance = NULL; + VacuumActiveNWorkers = NULL; /* * Loop to process each selected relation. diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index 22cca70687..774ff2fc7c 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -107,6 +107,8 @@ VACUUM (PARALLEL 2) pvactst; -- VACUUM invokes parallel bulk-deletion UPDATE pvactst SET i = i WHERE i < 1000; VACUUM (PARALLEL 2) pvactst; +UPDATE pvactst SET i = i WHERE i < 1000; +VACUUM (PARALLEL 0) pvactst; -- disable parallel vacuum VACUUM (PARALLEL -1) pvactst; -- error ERROR: parallel vacuum degree must be between 0 and 1024 LINE 1: VACUUM (PARALLEL -1) pvactst; diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql index d6859a5bc9..fbd364d7d0 100644 --- a/src/test/regress/sql/vacuum.sql +++ b/src/test/regress/sql/vacuum.sql @@ -93,6 +93,9 @@ VACUUM (PARALLEL 2) pvactst; UPDATE pvactst SET i = i WHERE i < 1000; VACUUM (PARALLEL 2) pvactst; +UPDATE pvactst SET i = i WHERE i < 1000; +VACUUM (PARALLEL 0) pvactst; -- disable parallel vacuum + VACUUM (PARALLEL -1) pvactst; -- error VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst; VACUUM (PARALLEL 2, FULL TRUE) pvactst; -- error, cannot use both PARALLEL and FULL