Improve docs and error messages for parallel vacuum.
authorAmit Kapila <akapila@postgresql.org>
Tue, 25 May 2021 03:56:53 +0000 (09:26 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 25 May 2021 03:56:53 +0000 (09:26 +0530)
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
src/backend/commands/vacuum.c
src/bin/scripts/vacuumdb.c
src/test/regress/expected/vacuum.out

index 843a82e871172507f1ad8efdbc1d8805a4908210..3e7f7ed68fbbbc4a3cda58e2b2d52a5d26450518 100644 (file)
@@ -275,11 +275,11 @@ PostgreSQL documentation
      </varlistentry>
 
      <varlistentry>
-      <term><option>-P <replaceable class="parameter">parallel_degree</replaceable></option></term>
-      <term><option>--parallel=<replaceable class="parameter">parallel_degree</replaceable></option></term>
+      <term><option>-P <replaceable class="parameter">parallel_workers</replaceable></option></term>
+      <term><option>--parallel=<replaceable class="parameter">parallel_workers</replaceable></option></term>
       <listitem>
        <para>
-        Specify the parallel degree of <firstterm>parallel vacuum</firstterm>.
+        Specify the number of parallel workers for <firstterm>parallel vacuum</firstterm>.
         This allows the vacuum to leverage multiple CPUs to process indexes.
         See <xref linkend="sql-vacuum"/>.
        </para>
index d549d0d86fb12bba646c65c105f7c596a97a435b..7421d7cfbd36309aaccd5a2825c455803a9fb984 100644 (file)
@@ -165,7 +165,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)));
 
index 7901c41f1601491dd89d0ace97efcc2e209cba3e..069a861aab79e678a8964ee2a91d9dc98a9f7af5 100644 (file)
@@ -200,7 +200,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;
@@ -1000,7 +1000,7 @@ help(const char *progname)
    printf(_("      --no-index-cleanup          don't remove index entries that point to dead tuples\n"));
    printf(_("      --no-process-toast          skip the TOAST table associated with the table to vacuum\n"));
    printf(_("      --no-truncate               don't truncate empty pages at the end of the table\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"));
index 90cea6caa86d32d0fb19049a670d51605599bf6a..5e657849aadd5a45007b760651a65db9c4f073a6 100644 (file)
@@ -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;