postgresql/src
Tom Lane 3e3f8f2020 Fix bogus cache-invalidation logic in logical replication worker.
The code recorded cache invalidation events by zeroing the "localreloid"
field of affected cache entries.  However, it's possible for an inval
event to occur even while we have the entry open and locked.  So an
ill-timed inval could result in "cache lookup failed for relation 0"
errors, if the worker's code tried to use the cleared field.  We can
fix that by creating a separate bool field to record whether the entry
needs to be revalidated.  (In the back branches, cram the bool into
what had been padding space, to avoid an ABI break in the somewhat
unlikely event that any extension is looking at this struct.)

Also, rearrange the logic in logicalrep_rel_open so that it
does the right thing in cases where table_open would fail.
We should retry the lookup by name in that case, but we didn't.

The real-world impact of this is probably small.  In the first place,
the error conditions are very low probability, and in the second place,
the worker would just exit and get restarted.  We only noticed because
in a CLOBBER_CACHE_ALWAYS build, the failure can occur repeatedly,
preventing the worker from making progress.  Nonetheless, it's clearly
a bug, and it impedes a useful type of testing; so back-patch to v10
where this code was introduced.

Discussion: https://postgr.es/m/1032727.1600096803@sss.pgh.pa.us
2020-09-16 12:07:31 -04:00
..
backend Fix bogus cache-invalidation logic in logical replication worker. 2020-09-16 12:07:31 -04:00
bin Translation updates 2020-09-14 13:14:53 +02:00
common Move frontend-side archive APIs from src/common/ to src/fe_utils/ 2020-06-11 15:48:56 +09:00
fe_utils Message fixes and style improvements 2020-09-14 06:42:07 +02:00
include Fix bogus cache-invalidation logic in logical replication worker. 2020-09-16 12:07:31 -04:00
interfaces Translation updates 2020-09-14 13:14:53 +02:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Translation updates 2020-09-14 13:14:53 +02:00
port Clear some style deviations. 2020-05-21 08:31:16 -07:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
timezone Ensure that distributed timezone abbreviation files are plain ASCII. 2020-07-17 11:04:22 -04:00
tools Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:58 -07:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Update Unicode data to Unicode 13.0.0 and CLDR 37 2020-04-24 09:52:59 +02:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00