pgsql: Improve invalidation handling in pgoutput.c. - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Improve invalidation handling in pgoutput.c.
Date
Msg-id E1nFo5h-0000Nt-K4@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve invalidation handling in pgoutput.c.

Fix the following issues in pgoutput.c:

* rel_sync_cache_relation_cb does the wrong thing when called for a cache
flush (i.e., relid == 0). Instead of invalidating all RelationSyncCache
entries as it should, it does nothing.

* When rel_sync_cache_relation_cb does invalidate an entry, it immediately
zaps the entry->map structure, even though that might still be in use. We
instead just mark the entry as invalid and rebuild it at a later safe
point.

* Similarly, rel_sync_cache_publication_cb is way too eager to reset the
pubactions flags, which would likely lead to failing to transmit changes
that we should transmit. In this case also, we just mark the entry as
invalid and rebuild it at a later safe point.

Author: Tom Lane
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/885288.1641420714@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7f481b8d3884445b3839e402bf6d156e458ffeb6

Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 115 ++++++++++++++++------------
1 file changed, 68 insertions(+), 47 deletions(-)


pgsql-committers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: pgsql: Further fix for EvalPlanQual with mix of local and foreign parti
Next
From: Thomas Munro
Date:
Subject: pgsql: Track LLVM 14 API changes, up to 2022-01-30.