Re: Add an option to skip loading missing publication to avoid logical replication failure

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, vignesh C <vignesh21@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-30T05:52:13Z
Lists: pgsql-hackers
Amit Kapila <amit.kapila16@gmail.com> writes:
> Thanks, Dilip and Sawada-San, for the inputs, and Vignesh for the
> patch. I have pushed the change.

Xuneng Zhou pointed out on Discord that the test case added by
7c99dc587 has caused repeated failures in CI --- though oddly,
it's not failed in the buildfarm so far as I can find.  The
failures look like

timed out waiting for match: (?^:WARNING: ( [A-Z0-9]+:)? skipped loading publication: tap_pub_3) at /tmp/cirrus-ci-build/src/test/subscription/t/024_add_drop_pub.pl line 103.

I suspect that what is happening is that the "skipped loading
publication" message comes out sooner than the 024 test script
expects, and thus that it could be fixed by moving the
"my $offset = -s $node_publisher->logfile;" line to be just
before the ALTER SUBSCRIPTION command instead of just after it.
Because the "skipped" message is from LoadPublications() which
is fundamentally invoked as a result of cache flushes, it's
hardly astonishing that its timing would be erratic.

However, I can't really prove this because I've been unable
to reproduce the failure locally, except by moving the
"my $offset" assignment further down which is surely cheating.

Thoughts?

			regards, tom lane



Commits

  1. Fix the race condition in the test added by 7c99dc587.