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 1jMFbO-0000l9-Tv for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 18:39:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jMFbN-0003rz-P9 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 18:39:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMFbN-0003rs-E9 for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2020 18:39:05 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jMFbG-0003nS-84 for pgsql-hackers@postgresql.org; Wed, 08 Apr 2020 18:39:04 +0000 Received: by mail-qk1-x743.google.com with SMTP id y3so1296230qky.8 for ; Wed, 08 Apr 2020 11:38:57 -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=hahc51ReoCnNpWWr3mme03RWdmctJiGCXZ0fEy5UzWY=; b=xcSxFWj8kOrqc0Qktg7wWbj/b8z+1rKBypag8fp0WTAWwDeH+8OUrBbV+G4HpX+p3D 4sDVUuCTgA194/212cXTO4qRJiRF3yOI/sObdke/1UYywM2SfQi+4A+Z5AUbgub9iQf9 Vp6uc8esXaHVCB5TUmKt07/mdOJSdYo5ichFAmefkGeNosSEuubtDLtSg6PB0q7mJ6Y9 1JJpd+PT9fm5ahHd79NlOu1fqZM5PVc/VKKIZkNu8+Cl7qIpH9DTbBpE5Za0lWVLVxaH d9mL7v2U9b4fXedThu9eb2NsFu4IsEjFkokJBff1fU0AHowz3Ub/4gjtcaAhqhvX0hLE CATQ== 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=hahc51ReoCnNpWWr3mme03RWdmctJiGCXZ0fEy5UzWY=; b=X0SPhbM2qkvhANNsfjOpTwm0MqFiPH0vWb6xkh9xo869RcNRZ8qpYunjxaHXI/1185 mfQ9a72Y7kyhwtA1aJXADv5Yuzhgw7ImfPHpFjtM8HPDZDO1CilRdVXpuVmQ9pmJrrwI h2MKfrQZwnENCDNbQAk4HI67Q/6X4Fe2a9ZVdGEwaMVnrQ4rKPmXyTGC7whb8KUnV/Jc NHs3J9xOk+m1mdmTzpxohSeXjGPU6w3g2jkh9Kq446NlUiVXOThlEUlj2qCkgHWs/FSZ mE44i29cuotdVTX7qVGtfPEqpZZJ0AbQFRQg5696htWfTKcMbPF/1yCjUUf6Pw0qC/W6 56PA== X-Gm-Message-State: AGi0PuaTNmjzEbO3piVCiCsxojDYUPAdrPj528+1PHzL7+pSKj1sDw6Z ldNG5tgBL0UdObPWmLIMcPr+1g== X-Google-Smtp-Source: APiQypIeOus67QvdX2QXvru9EUDFaWFB6TfBh9f3AIRr2P7B1jhoDCOBjOv7pfVCO3ocR5C54CYaSA== X-Received: by 2002:a37:ae04:: with SMTP id x4mr8982977qke.278.1586371136538; Wed, 08 Apr 2020 11:38:56 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id j15sm19531445qtr.40.2020.04.08.11.38.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Apr 2020 11:38:55 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 42D82800B38; Wed, 8 Apr 2020 13:38:54 -0500 (CDT) Date: Wed, 8 Apr 2020 13:38:54 -0500 From: Justin Pryzby To: Mahendra Singh Thalor Cc: Robert Haas , tushar , PostgreSQL-development Subject: Re: Vacuum o/p with (full 1, parallel 0) option throwing an error Message-ID: <20200408183854.GG2228@telsasoft.com> References: <58c8d171-e665-6fa3-a9d3-d9423b694dae@enterprisedb.com> <20200408164154.GD2228@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 On Thu, Apr 09, 2020 at 12:06:04AM +0530, Mahendra Singh Thalor wrote: > On Wed, 8 Apr 2020 at 22:11, Justin Pryzby wrote: > > > > On Wed, Apr 08, 2020 at 11:57:08AM -0400, Robert Haas wrote: > > > On Wed, Apr 8, 2020 at 10:25 AM Mahendra Singh Thalor > > > wrote: > > > > I think, Tushar point is that either we should allow both > > > > vacuum(parallel 0, full 1) and vacuum(parallel 1, full 0) or in the > > > > both cases, we should through error. > > > > > > Oh, yeah, good point. Somebody must not've been careful enough with > > > the options-checking code. > > > > Actually I think someone was too careful. > > > > From 9256cdb0a77fb33194727e265a346407921055ef Mon Sep 17 00:00:00 2001 > > From: Justin Pryzby > > Date: Wed, 8 Apr 2020 11:38:36 -0500 > > Subject: [PATCH v1] parallel vacuum: options check to use same test as in > > vacuumlazy.c > > > > --- > > src/backend/commands/vacuum.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c > > index 351d5215a9..660c854d49 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,7 +197,7 @@ 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"))); > > -- > > 2.17.0 > > > > Thanks Justin for the patch. > > Patch looks fine to me and it is fixing the issue. After applying this > patch, vacuum will work as: > > 1) vacuum (parallel 1, full 0); > -- vacuuming will be done with 1 parallel worker. > 2) vacuum (parallel 0, full 1); > -- full vacuuming will be done. > 3) vacuum (parallel 1, full 1); > -- will give error :ERROR: cannot specify both FULL and PARALLEL options > > 3rd example is telling that we can't give both FULL and PARALLEL > options but in 1st and 2nd, we are giving both FULL and PARALLEL > options and we are not giving any error. I think, irrespective of > value of both FULL and PARALLEL options, we should give error in all > the above mentioned three cases. I think the behavior is correct, but the error message could be improved, like: |ERROR: cannot specify FULL with PARALLEL jobs or similar. -- Justin