public inbox for [email protected]  
help / color / mirror / Atom feed
From: Amit Kapila <[email protected]>
To: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Add an option to skip loading missing publication to avoid logical replication failure
Date: Mon, 3 Mar 2025 16:41:38 +0530
Message-ID: <CAA4eK1LSOUXoH+gY1OikbHajxpgbZJqs=jfYGDmckuWWXzcLMQ@mail.gmail.com> (raw)
In-Reply-To: <CALDaNm1Lg1YOtY+Sy2his=ikHsQYYQ1pWN620QiBZDBdbsjMHw@mail.gmail.com>
References: <CALDaNm0-n8FGAorM+bTxkzn+AOUyx5=L_XmnvOP6T24+-NcBKg@mail.gmail.com>
	<CAA4eK1+gaEyYJpsGZktfXptU4gbLcwbzFTC0TBZc1UY2SBPydw@mail.gmail.com>
	<CALDaNm2VTjKe8mQsTXFvrbgzcSO4OiuyOdw4VDBK_Ntn=ay-bQ@mail.gmail.com>
	<CAA4eK1+37NhZg+q_UdX6Bfm1ikfoZPZaS0nqPY6xtMNs4BPQnw@mail.gmail.com>
	<CALDaNm13A+KyNu47YMyu+tL4XeombTHzZt3fpD1QLxh_Mtw+WQ@mail.gmail.com>
	<CALDaNm1Lg1YOtY+Sy2his=ikHsQYYQ1pWN620QiBZDBdbsjMHw@mail.gmail.com>

On Mon, Mar 3, 2025 at 2:30 PM vignesh C <[email protected]> wrote:
>
> On Tue, 25 Feb 2025 at 15:32, vignesh C <[email protected]> wrote:
> >
> > The attached script has the script that was used for testing. Here the
> > NUM_RECORDS count should be changed accordingly for each of the tests
> > and while running the test with the patch change uncomment the drop
> > publication command.
>
> I have done further analysis on the test and changed the test to
> compare it better with HEAD. The execution time is in milliseconds.
> Brach/records  |  100     |  1000   |  10000    |  100000  |  1000000
> Head               |   10.43  |  15.86  |   64.44    |  550.56  |   8991.04
> Patch              |   11.35  |  17.26   |   73.50    |  640.21  |  10104.72
> % diff              |   -8.82  |  -8.85    |   -14.08   |   -16.28  |  -12.38
>
> There is a  performance degradation in the range of 8.8 to 16.2 percent.
>

- /* Validate the entry */
- if (!entry->replicate_valid)
+ /*
+ * If the publication is invalid, check for updates.
+ * This optimization ensures that the next block, which queries the system
+ * tables and builds the relation entry, runs only if a new publication was
+ * created.
+ */
+ if (!publications_valid && data->publications)
+ {
+ bool skipped_pub = false;
+ List    *publications;
+
+ publications = LoadPublications(data->publication_names, &skipped_pub);

The publications_valid flag indicates whether the publications cache
is valid or not; the flag is set to false for any invalidation in the
pg_publication catalog. I wonder that instead of using the same flag
what if we use a separate publications_skipped flag? If that works,
you don't even need to change the current location where we
LoadPublications.

-- 
With Regards,
Amit Kapila.






view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Add an option to skip loading missing publication to avoid logical replication failure
  In-Reply-To: <CAA4eK1LSOUXoH+gY1OikbHajxpgbZJqs=jfYGDmckuWWXzcLMQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox