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 1oqmmX-00032F-8r for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 02:50:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oqmmW-0001YQ-3B for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 02:50:08 +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 1oqmmV-0001YE-OP for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 02:50:07 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oqmmP-00056Z-2o for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 02:50:07 +0000 Received: by mail-pf1-x431.google.com with SMTP id i3so3337314pfc.11 for ; Thu, 03 Nov 2022 19:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s7iHs6SSMrOAgAQGoZmrYkplhEmmuLop++Yi2b62KHU=; b=L3vv7+FP/Q2JntVVrb6bY98hlRbS0K/6CpwdsS/a4liV7BgSM8NDGFGPOF4Vdw2nXR jOjqIwWxvBdAnx5eEo7HNgXyv3H7l45lhsME3ULWf/iEk5h5GTl73G6cmKd5dFDKTpT/ 2BnlBstsze5FmZW95jTtZpXO2AxqKHM67O5xe1UILNgrqFwQa/s/6r9i2df2SdOWpFAn ZECDFdcnm8u2sSWotcalvB9H4jHx5pC1ms5CpPXk0qxI/k/xIUejD96oxEwVrg3aKPrv cB0/bvvi/bjS15QyjRHAbnBlY8H4AifbT7WniwovEinwELHW+vdnyHEF8QUXR6Pf+c7k ovSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s7iHs6SSMrOAgAQGoZmrYkplhEmmuLop++Yi2b62KHU=; b=6/4Au/5Pt34HjG/IxdYCxukBKD4jW/VfKTitXsgXMhR1I9jwvJxMY7LGYrmvqGu0IT zYgW9LC8VLOALzhCg4OxRWIE9tZGiLtwtZZly7dLwVM6ZUwlvsBZDyuPCdn/tgS2zWL3 0wfAzJ/cTpgmYN9AeACP2oolYV25ZwZoU5jHbuy+1v3QxlBfl/8nNYDMkWTF7DjLeapa 4mAqBM8uYbhDjKbDaQcsAEKpOA8WEY/BBvg/jYDiJohURcd5N85CpJPLLThFhbMGdc0+ A07AvtPHypW9fqhE+EcA3Jh8FAOl5kaASRNMeZvSJm6QaI1DC+YR1/zpZytTc1oetiqn WwDg== X-Gm-Message-State: ACrzQf1xGlva8gT6PTAi1D0XosA5X4EYPJ1A7LOX4jF+Hf+n+KpypOTe HAzt6Y0lhGI1VT6kTeCrg+XQzNHVoJjy2Kr4EkA= X-Google-Smtp-Source: AMsMyM76gKsNe1owyLC2VymdWiWotLs2Grv/e4Brm2XgeM9+MTEs+3YJ/t612RJvLKRJ5Y3/WyATz+QPOGVrzCC08dI= X-Received: by 2002:a63:84c6:0:b0:46f:f8b0:ba09 with SMTP id k189-20020a6384c6000000b0046ff8b0ba09mr13068040pgd.192.1667530198807; Thu, 03 Nov 2022 19:49:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ian Lawrence Barwick Date: Fri, 4 Nov 2022 11:49:46 +0900 Message-ID: Subject: Re: Skipping schema changes in publication To: vignesh C Cc: "osumi.takamichi@fujitsu.com" , Peter Smith , Amit Kapila , Bharath Rupireddy , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 2022=E5=B9=B48=E6=9C=8819=E6=97=A5(=E9=87=91) 2:41 vignesh C : > > On Mon, Aug 8, 2022 at 2:53 PM vignesh C wrote: > > > > On Mon, Aug 8, 2022 at 12:46 PM vignesh C wrote: > > > > > > On Fri, Jun 3, 2022 at 3:36 PM vignesh C wrote: > > > > > > > > On Thu, May 26, 2022 at 7:04 PM osumi.takamichi@fujitsu.com > > > > wrote: > > > > > > > > > > On Monday, May 23, 2022 2:13 PM vignesh C w= rote: > > > > > > Attached v7 patch which fixes the buildfarm warning for an unus= ed warning in > > > > > > release mode as in [1]. > > > > > Hi, thank you for the patches. > > > > > > > > > > > > > > > I'll share several review comments. > > > > > > > > > > For v7-0001. > > > > > > > > > > (1) I'll suggest some minor rewording. > > > > > > > > > > + > > > > > + The RESET clause will reset the publicatio= n to the > > > > > + default state which includes resetting the publication option= s, setting > > > > > + ALL TABLES flag to false and > > > > > + dropping all relations and schemas that are associated with t= he publication. > > > > > > > > > > My suggestion is > > > > > "The RESET clause will reset the publication to the > > > > > default state. It resets the publication operations, > > > > > sets ALL TABLES flag to false and drops all relations > > > > > and schemas associated with the publication." > > > > > > > > I felt the existing looks better. I would prefer to keep it that wa= y. > > > > > > > > > (2) typo and rewording > > > > > > > > > > +/* > > > > > + * Reset the publication. > > > > > + * > > > > > + * Reset the publication options, setting ALL TABLES flag to fal= se and drop > > > > > + * all relations and schemas that are associated with the public= ation. > > > > > + */ > > > > > > > > > > The "setting" in this sentence should be "set". > > > > > > > > > > How about changing like below ? > > > > > FROM: > > > > > "Reset the publication options, setting ALL TABLES flag to false = and drop > > > > > all relations and schemas that are associated with the publicatio= n." > > > > > TO: > > > > > "Reset the publication operations, set ALL TABLES flag to false a= nd drop > > > > > all relations and schemas associated with the publication." > > > > > > > > I felt the existing looks better. I would prefer to keep it that w= ay. > > > > > > > > > (3) AlterPublicationReset > > > > > > > > > > Do we need to call CacheInvalidateRelcacheAll() or > > > > > InvalidatePublicationRels() at the end of > > > > > AlterPublicationReset() like AlterPublicationOptions() ? > > > > > > > > CacheInvalidateRelcacheAll should be called if we change all tables > > > > from true to false, else the cache will not be invalidated. Modifie= d > > > > > > > > > > > > > > For v7-0002. > > > > > > > > > > (4) > > > > > > > > > > + if (stmt->for_all_tables) > > > > > + { > > > > > + bool isdefault =3D CheckPublicationDef= Values(tup); > > > > > + > > > > > + if (!isdefault) > > > > > + ereport(ERROR, > > > > > + errcode(ERRCODE_INVALID_O= BJECT_DEFINITION), > > > > > + errmsg("adding ALL TABLES= requires the publication to have default publication options, no tables/..= .. > > > > > + errhint("Use ALTER PUBLIC= ATION ... RESET to reset the publication")); > > > > > > > > > > > > > > > The errmsg string has three messages for user and is a bit long > > > > > (we have two sentences there connected by 'and'). > > > > > Can't we make it concise and split it into a couple of lines for = code readability ? > > > > > > > > > > I'll suggest a change below. > > > > > FROM: > > > > > "adding ALL TABLES requires the publication to have default publi= cation options, no tables/schemas associated and ALL TABLES flag should not= be set" > > > > > TO: > > > > > "adding ALL TABLES requires the publication defined not for ALL T= ABLES" > > > > > "to have default publish actions without any associated tables/sc= hemas" > > > > > > > > Added errdetail and split it > > > > > > > > > (5) typo > > > > > > > > > > > > > > > + EXCEPT TABLE > > > > > + > > > > > + > > > > > + This clause specifies a list of tables to exclude from the= publication. > > > > > + It can only be used with FOR ALL TABLES= . > > > > > + > > > > > + > > > > > + > > > > > + > > > > > > > > > > Kindly change > > > > > FROM: > > > > > This clause specifies a list of tables to exclude from the public= ation. > > > > > TO: > > > > > This clause specifies a list of tables to be excluded from the pu= blication. > > > > > or > > > > > This clause specifies a list of tables excluded from the publicat= ion. > > > > > > > > Modified > > > > > > > > > (6) Minor suggestion for an expression change > > > > > > > > > > Marks the publication as one that replicates changes for a= ll tables in > > > > > - the database, including tables created in the future. > > > > > + the database, including tables created in the future. If > > > > > + EXCEPT TABLE is specified, then exclude= replicating > > > > > + the changes for the specified tables. > > > > > > > > > > > > > > > I'll suggest a minor rewording. > > > > > FROM: > > > > > ...exclude replicating the changes for the specified tables > > > > > TO: > > > > > ...exclude replication changes for the specified tables > > > > > > > > I felt the existing is better. > > > > > > > > > (7) > > > > > (7-1) > > > > > > > > > > +/* > > > > > + * Check if the publication has default values > > > > > + * > > > > > + * Check the following: > > > > > + * a) Publication is not set with "FOR ALL TABLES" > > > > > + * b) Publication is having default options > > > > > + * c) Publication is not associated with schemas > > > > > + * d) Publication is not associated with relations > > > > > + */ > > > > > +static bool > > > > > +CheckPublicationDefValues(HeapTuple tup) > > > > > > > > > > > > > > > I think this header comment can be improved. > > > > > FROM: > > > > > Check the following: > > > > > TO: > > > > > Returns true if the publication satisfies all the following condi= tions: > > > > > > > > Modified > > > > > > > > > (7-2) > > > > > > > > > > b) should be changed as well > > > > > FROM: > > > > > Publication is having default options > > > > > TO: > > > > > Publication has the default publish operations > > > > > > > > Changed it to "Publication is having default publication parameter = values" > > > > > > > > Thanks for the comments, the attached v8 patch has the changes for = the same. > > > > > > The patch needed to be rebased on top of HEAD because of commit > > > "0c20dd33db1607d6a85ffce24238c1e55e384b49", attached a rebased v8 > > > version for the changes of the same. > > > > I had missed attaching one of the changes that was present locally. > > The updated patch has the changes for the same. > > The patch needed to be rebased on top of HEAD because of a recent > commit. The updated v8 patch has the changes for the same. Hi cfbot reports the patch no longer applies [1]. As CommitFest 2022-11 is currently underway, this would be an excellent time to update the patch. [1] http://cfbot.cputube.org/patch_40_3646.log Thanks Ian Barwick