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 1oOZYl-0008Dc-1x for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 07:03:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOZYj-0001I0-S6 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 07:03:17 +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 1oOZYj-0001Hr-Co for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 07:03:17 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oOZYc-0005VC-N5 for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 07:03:16 +0000 Received: by mail-ej1-x62e.google.com with SMTP id dc19so1537552ejb.12 for ; Thu, 18 Aug 2022 00:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=PjdWOliqs0JVZNan6V9h08/5L1tRGyZ4boSy0/7OAwM=; b=Qiu+pLzhnpNnfF5WDTxnutK9FDqwOjB1exKnRc/zNt/CsyP3UZYzYX2jScGtOKYcVr VIldeTn8TVomHg+haO3RzC1uA7yYTbNFqN0SJZAhm3uaoHQ3axXgZvteg20ipA4UlUH7 IROJSfv/6GDPRFq6DZfE408V0Wfz9OEHJ4PuSsMP0q8QHeyEQLSaWR9ZcrzECsQ7ZbYK AK7R3bel3YpVlHm0Cbhc++qmdeFVhW8wNP60bXYU0aRumf9OUnedapUhSv1iYu13iue/ vV0e1Yxz8VQoy/rRBj52jbD3ARVe1tYft2K9Ns2G6Y9oDlsZpVtImX1t6x6HtL3cSJPv WaZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=PjdWOliqs0JVZNan6V9h08/5L1tRGyZ4boSy0/7OAwM=; b=Il7/+Doc5QfYcq8jdyHP8ZwLW9Wh6/EKAVYS+Qv1Msp0P1lkld+m1sYkHamFjtczrW /yUCyRk9dLU0is4LaSxI6jD0gtMioOO0RzN9jzADS/yGQ9NJGStW08BPkStl6bKQ3zy4 YA5OsVe8vJKx9qzY9vsnBwjRmBsDfLeFtwnG0vUo/WFwwU4v2hyF0h0V+fsplklxmIuY jfKQj3FewZl1EI82VcsKUBL0QVP+Mif3FdTcs3nGuYlL0G927gP1apIiiZEQ7+SbNtgd nDsl6pdButSdC/1+Sp/46i0D94a13feBoRThf3OK6CZI2b4FBjajR4yhVCIwDcTIpkys WZ7Q== X-Gm-Message-State: ACgBeo2nSA8PT+ZMO9aIshsMePlAJXxEM0bewR0NeAbB4iFYA3CEeY/V 2bnmKKEhpC/yTRqVh2cjlq87TSc36I59rAWp6B8= X-Google-Smtp-Source: AA6agR4404I2O9vx8gpJw34gMc2trS13hcN9wvmJhrZ+v3UrzwGaibYbIHnNey1WI3GFJCDSX/fn/CwnD+pM39HURbU= X-Received: by 2002:a17:907:a046:b0:730:9c7a:eab3 with SMTP id gz6-20020a170907a04600b007309c7aeab3mr1076334ejc.285.1660806188064; Thu, 18 Aug 2022 00:03:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nitin Jadhav Date: Thu, 18 Aug 2022 12:32:31 +0530 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" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I spent some time on understanding the proposal and the patch. Here are a few comments wrt the test cases. > +ALTER PUBLICATION testpub_reset ADD TABLE pub_sch1.tbl1; > + > +-- Verify that tables associated with the publication are dropped after RESET > +\dRp+ testpub_reset > +ALTER PUBLICATION testpub_reset RESET; > +\dRp+ testpub_reset > > +ALTER PUBLICATION testpub_reset ADD ALL TABLES IN SCHEMA public; > + > +-- Verify that schemas associated with the publication are dropped after RESET > +\dRp+ testpub_reset > +ALTER PUBLICATION testpub_reset RESET; > +\dRp+ testpub_reset The results for the above two cases are the same before and after the reset. Is there any way to verify that? --- > +-- Can't add EXCEPT TABLE to 'FOR ALL TABLES' publication > +ALTER PUBLICATION testpub_reset ADD ALL TABLES EXCEPT TABLE pub_sch1.tbl1; > + > > +-- Can't add EXCEPT TABLE to 'FOR TABLE' publication > +ALTER PUBLICATION testpub_reset ADD ALL TABLES EXCEPT TABLE pub_sch1.tbl1; > + > > +-- Can't add EXCEPT TABLE to 'FOR ALL TABLES IN SCHEMA' publication > +ALTER PUBLICATION testpub_reset ADD ALL TABLES EXCEPT TABLE pub_sch1.tbl1; > + I did not understand the objective of these tests. I think we need to improve the comments. Thanks & Regards, 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 wrote: > > > > > Attached v7 patch which fixes the buildfarm warning for an unused 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 publication to the > > > > + default state which includes resetting the publication options, setting > > > > + ALL TABLES flag to false and > > > > + dropping all relations and schemas that are associated with the 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 way. > > > > > > > (2) typo and rewording > > > > > > > > +/* > > > > + * Reset the publication. > > > > + * > > > > + * Reset the publication options, setting ALL TABLES flag to false and drop > > > > + * all relations and schemas that are associated with the publication. > > > > + */ > > > > > > > > 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 publication." > > > > TO: > > > > "Reset the publication operations, set ALL TABLES flag to false and drop > > > > all relations and schemas associated with the publication." > > > > > > I felt the existing looks better. I would prefer to keep it that way. > > > > > > > (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. Modified > > > > > > > > > > > For v7-0002. > > > > > > > > (4) > > > > > > > > + if (stmt->for_all_tables) > > > > + { > > > > + bool isdefault = CheckPublicationDefValues(tup); > > > > + > > > > + if (!isdefault) > > > > + ereport(ERROR, > > > > + errcode(ERRCODE_INVALID_OBJECT_DEFINITION), > > > > + errmsg("adding ALL TABLES requires the publication to have default publication options, no tables/.... > > > > + errhint("Use ALTER PUBLICATION ... 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 publication options, no tables/schemas associated and ALL TABLES flag should not be set" > > > > TO: > > > > "adding ALL TABLES requires the publication defined not for ALL TABLES" > > > > "to have default publish actions without any associated tables/schemas" > > > > > > 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 publication. > > > > TO: > > > > This clause specifies a list of tables to be excluded from the publication. > > > > or > > > > This clause specifies a list of tables excluded from the publication. > > > > > > Modified > > > > > > > (6) Minor suggestion for an expression change > > > > > > > > Marks the publication as one that replicates changes for all 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 conditions: > > > > > > 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. > > Regards, > Vignesh