Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMtow-0008Ct-A8 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Apr 2020 13:35:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jMtov-0006Pf-0y for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Apr 2020 13:35:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMtou-0006KV-I6 for pgsql-hackers@lists.postgresql.org; Fri, 10 Apr 2020 13:35:44 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jMtom-0005Lc-P8 for pgsql-hackers@postgresql.org; Fri, 10 Apr 2020 13:35:43 +0000 Received: by mail-qk1-x72c.google.com with SMTP id 13so2052361qko.10 for ; Fri, 10 Apr 2020 06:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1DRwEybPuyWFHindOrcoReeyBbJYytTBu19gAkp7XZE=; b=hfUDCCD9Ldzg3Ykfz81Qm9O5UbGu7KESiKhc7nROLXrc8fFgGzrF7oUj4jut6/eOlV gxkXrFGMpRLPA4z7CSIgXJkWOMLh9Y/eWBv/9H1lpWUuRb/LTDRAwXyD0g3SwIgPkrYy GH+XfOLaZ8v35Rdc/Aq5KUcvbveBhrgBoQijPESEZS/AtrQqixqL3p5Ki29Qqt5c8/6c 7S6VviDBJztTEyfJ9jC8g+EF/ZHLcDl7X9AB9c8YHLi7zZe6BmkE5qUpNvmoz6XrPlla PwsStzCtH57IZX1AqEjNymX/K4/vgy1qD9cEr20lqBMO6+gbNPH4zNRbgyYoL116y8PR a2dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1DRwEybPuyWFHindOrcoReeyBbJYytTBu19gAkp7XZE=; b=fO0UNa8ftbqKKzAzjgYZXkrpRzlz1jdyLngu6RGBGcGplHI9m8vm3Jo8H1bM+h/D5O dRkGF9wNEOVTzhMK4wFtqyNKlGkK0182oXxVxVaoXy4Speayb/BNL1YPY9uGbF9yJsrg 1yqsMQDDXm4dKB6C0omLGGQggYYi1na8uQl6fIdbILW2PsCUXI6FbEne89129w9g7uED 0YkcepNOZd+JKO6ZayfuUsDtbzJPlRaAhqwYcPh4+gNz88D8RttbK4MXR0QghH27t7o4 JmGqQRGqKn4Gty74UaF7fNvT8eJLE061LkAC+Zoc6uGEHWKDGfu0An/xwMFqwD4G+ocg YW5Q== X-Gm-Message-State: AGi0PuYwQw7qgequxKUzFgs0ojOrMT31y8ZVwOiKiyEA62yP0B8b2GK7 7eGmWcmWAubgyh4RRlNATk5LAw== X-Google-Smtp-Source: APiQypKdBqCv5JZ34dChNAN/ldcRtPK1SnEygpajNcBkujx6+pY8S6KgW71L4CQSPgoOq3+cfsNZ0A== X-Received: by 2002:ae9:d8c4:: with SMTP id u187mr4121388qkf.354.1586525735277; Fri, 10 Apr 2020 06:35:35 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v5sm1637546qka.106.2020.04.10.06.35.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2020 06:35:34 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 3494A800B38; Fri, 10 Apr 2020 08:35:32 -0500 (CDT) Date: Fri, 10 Apr 2020 08:35:32 -0500 From: Justin Pryzby To: Amit Kapila Cc: Masahiko Sawada , Mahendra Singh Thalor , Robert Haas , tushar , pgsql-hackers@postgresql.org Subject: Re: Vacuum o/p with (full 1, parallel 0) option throwing an error Message-ID: <20200410133532.GA2228@telsasoft.com> References: <20200408164154.GD2228@telsasoft.com> <20200408183854.GG2228@telsasoft.com> <20200409083319.GN2228@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4ZVTVymsHR1TEBjP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --4ZVTVymsHR1TEBjP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 10, 2020 at 10:34:02AM +0530, Amit Kapila wrote: > On Thu, Apr 9, 2020 at 2:03 PM Justin Pryzby wrote: > > On Thu, Apr 09, 2020 at 05:07:48PM +0900, Masahiko Sawada wrote: > > > Yes but the difference is that we cannot disable PARSER or COPY by > > > specifying options whereas we can do something like "VACUUM (FULL > > > false) tbl" to disable FULL option. I might be misunderstanding the > > > meaning of "specify" though. > > > > You have it right. > > > > We should fix the behavior, but change the error message for consistency with > > that change, like so. > > > > Okay, but I think the error message suggested by Robert "ERROR: VACUUM > FULL cannot be performed in parallel" sounds better than what you have > proposed. What do you think? No problem. I think I was trying to make my text similar to that from 14a4f6f37. I realized that I didn't sq!uash my last patch, so it didn't include the functional change (which is maybe what Robert was referring to). -- Justin --4ZVTVymsHR1TEBjP Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v3-0001-Allow-specifying-parallel-0-with-vacuum-full.patch" From 16ff7441791c481ab97b7eb8b2948e38626c7273 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Wed, 8 Apr 2020 11:38:36 -0500 Subject: [PATCH v3] Allow specifying "(parallel 0)" with "vacuum(full)".. ..even though full implies parallel 0 Check options using the same test as in vacuumlazy.c See also similar change long ago: 14a4f6f3748df4ff63bb2d2d01146b2b98df20ef Discussion: https://www.postgresql.org/message-id/58c8d171-e665-6fa3-a9d3-d9423b694dae%40enterprisedb.com --- src/backend/commands/vacuum.c | 6 ++---- src/test/regress/expected/vacuum.out | 5 +++-- src/test/regress/sql/vacuum.sql | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 351d5215a9..9cb65d76a9 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -104,7 +104,6 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) bool freeze = false; bool full = false; bool disable_page_skipping = false; - bool parallel_option = false; ListCell *lc; /* Set default value */ @@ -145,7 +144,6 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) params.truncate = get_vacopt_ternary_value(opt); else if (strcmp(opt->defname, "parallel") == 0) { - parallel_option = true; if (opt->arg == NULL) { ereport(ERROR, @@ -199,10 +197,10 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) !(params.options & (VACOPT_FULL | VACOPT_FREEZE))); Assert(!(params.options & VACOPT_SKIPTOAST)); - if ((params.options & VACOPT_FULL) && parallel_option) + if ((params.options & VACOPT_FULL) && params.nworkers > 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot specify both FULL and PARALLEL options"))); + errmsg("VACUUM FULL cannot be performed in parallel"))); /* * Make sure VACOPT_ANALYZE is specified if any column lists are present. diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index 0cfe28e63f..f90c498813 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -115,14 +115,15 @@ LINE 1: VACUUM (PARALLEL -1) pvactst; ^ VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst; VACUUM (PARALLEL 2, FULL TRUE) pvactst; -- error, cannot use both PARALLEL and FULL -ERROR: cannot specify both FULL and PARALLEL options +ERROR: VACUUM FULL cannot be performed in parallel +VACUUM (PARALLEL 0, FULL TRUE) pvactst; -- can specify parallel disabled (even though that's implied by FULL) VACUUM (PARALLEL) pvactst; -- error, cannot use PARALLEL option without parallel degree ERROR: parallel option requires a value between 0 and 1024 LINE 1: VACUUM (PARALLEL) pvactst; ^ CREATE TEMPORARY TABLE tmp (a int PRIMARY KEY); CREATE INDEX tmp_idx1 ON tmp (a); -VACUUM (PARALLEL 1) tmp; -- disables parallel vacuum option +VACUUM (PARALLEL 1) tmp; -- parallel vacuum disabled for temp tables WARNING: disabling parallel option of vacuum on "tmp" --- cannot vacuum temporary tables in parallel RESET min_parallel_index_scan_size; DROP TABLE pvactst; diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql index cf741f7b11..dade1e5e57 100644 --- a/src/test/regress/sql/vacuum.sql +++ b/src/test/regress/sql/vacuum.sql @@ -99,10 +99,11 @@ 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 +VACUUM (PARALLEL 0, FULL TRUE) pvactst; -- can specify parallel disabled (even though that's implied by FULL) VACUUM (PARALLEL) pvactst; -- error, cannot use PARALLEL option without parallel degree CREATE TEMPORARY TABLE tmp (a int PRIMARY KEY); CREATE INDEX tmp_idx1 ON tmp (a); -VACUUM (PARALLEL 1) tmp; -- disables parallel vacuum option +VACUUM (PARALLEL 1) tmp; -- parallel vacuum disabled for temp tables RESET min_parallel_index_scan_size; DROP TABLE pvactst; -- 2.17.0 --4ZVTVymsHR1TEBjP--