[COMMITTERS] pgsql: Fix, or at least ameliorate,bugs in logicalrep_worker_launch(). - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Fix, or at least ameliorate,bugs in logicalrep_worker_launch().
Date
Msg-id E1dty9Y-00022T-KB@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix, or at least ameliorate, bugs in logicalrep_worker_launch().

If we failed to get a background worker slot, the code just walked
away from the logicalrep-worker slot it already had, leaving that
looking like the worker is still starting up.  This led to an indefinite
hang in subscription startup, as reported by Thomas Munro.  We must
release the slot on failure.

Also fix a thinko: we must capture the worker slot's generation before
releasing LogicalRepWorkerLock the first time, else testing to see if
it's changed is pretty meaningless.

BTW, the CHECK_FOR_INTERRUPTS() in WaitForReplicationWorkerAttach is a
ticking time bomb, even without considering the possibility of elog(ERROR)
in one of the other functions it calls.  Really, this entire business needs
a redesign with some actual thought about error recovery.  But for now
I'm just band-aiding the case observed in testing.

Back-patch to v10 where this code was added.

Discussion: https://postgr.es/m/CAEepm=2bP3TBMFBArP6o20AZaRduWjMnjCjt22hSdnA-EvrtCw@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c1bde0747983993a695d12c4403a730b2be579d2

Modified Files
--------------
src/backend/replication/logical/launcher.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: [COMMITTERS] pgsql: Update some dead external links in the documentation
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names moreco