From 9012e5594c6ff803abb6d51e164797e3810845c1 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Tue, 25 May 2021 09:40:16 +0530 Subject: [PATCH] Improve docs and error messages for parallel vacuum. The error messages, docs, and one of the options were using 'parallel degree' to indicate parallelism used by vacuum command. We normally use 'parallel workers' at other places so change it for parallel vacuum accordingly. Author: Bharath Rupireddy Reviewed-by: Dilip Kumar, Amit Kapila Backpatch-through: 13 Discussion: https://postgr.es/m/CALj2ACWz=PYrrFXVsEKb9J1aiX4raA+UBe02hdRp_zqDkrWUiw@mail.gmail.com --- doc/src/sgml/ref/vacuumdb.sgml | 6 +++--- src/backend/commands/vacuum.c | 2 +- src/bin/scripts/vacuumdb.c | 4 ++-- src/test/regress/expected/vacuum.out | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index eeafed7fbe..61c2e7d237 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -230,11 +230,11 @@ PostgreSQL documentation - - + + - Specify the parallel degree of parallel vacuum. + Specify the number of parallel workers for parallel vacuum. This allows the vacuum to leverage multiple CPUs to process indexes. See . diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 92c4eb6a87..5ef6698790 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -160,7 +160,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) if (nworkers < 0 || nworkers > MAX_PARALLEL_WORKER_LIMIT) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("parallel vacuum degree must be between 0 and %d", + errmsg("parallel workers for vacuum must be between 0 and %d", MAX_PARALLEL_WORKER_LIMIT), parser_errposition(pstate, opt->location))); diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 3e57fa9a86..1cf689cd05 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -189,7 +189,7 @@ main(int argc, char *argv[]) vacopts.parallel_workers = atoi(optarg); if (vacopts.parallel_workers < 0) { - pg_log_error("parallel vacuum degree must be a non-negative integer"); + pg_log_error("parallel workers for vacuum must be greater than or equal to zero"); exit(1); } break; @@ -920,7 +920,7 @@ help(const char *progname) printf(_(" -j, --jobs=NUM use this many concurrent connections to vacuum\n")); printf(_(" --min-mxid-age=MXID_AGE minimum multixact ID age of tables to vacuum\n")); printf(_(" --min-xid-age=XID_AGE minimum transaction ID age of tables to vacuum\n")); - printf(_(" -P, --parallel=PARALLEL_DEGREE use this many background workers for vacuum, if available\n")); + printf(_(" -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum, if available\n")); printf(_(" -q, --quiet don't write any messages\n")); printf(_(" --skip-locked skip relations that cannot be immediately locked\n")); printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table(s) only\n")); diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index 3fccb183c0..d026847c15 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -110,7 +110,7 @@ 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 +ERROR: parallel workers for vacuum must be between 0 and 1024 LINE 1: VACUUM (PARALLEL -1) pvactst; ^ VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst;