pgsql: Improve relcache invalidation handling of currently invisible re - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Improve relcache invalidation handling of currently invisible re
Date
Msg-id E1Y8dnA-0003e1-Ei@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve relcache invalidation handling of currently invisible relations.

The corner case where a relcache invalidation tried to rebuild the
entry for a referenced relation but couldn't find it in the catalog
wasn't correct.

The code tried to RelationCacheDelete/RelationDestroyRelation the
entry. That didn't work when assertions are enabled because the latter
contains an assertion ensuring the refcount is zero. It's also more
generally a bad idea, because by virtue of being referenced somebody
might actually look at the entry, which is possible if the error is
trapped and handled via a subtransaction abort.

Instead just error out, without deleting the entry. As the entry is
marked invalid, the worst that can happen is that the invalid (and at
some point unused) entry lingers in the relcache.

Discussion: 22459.1418656530@sss.pgh.pa.us

There should be no way to hit this case < 9.4 where logical decoding
introduced a bug that can hit this. But since the code for handling
the corner case is there it should do something halfway sane, so
backpatch all the the way back.  The logical decoding bug will be
handled in a separate commit.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6cbadda25a3f52c1fb76ad309f9af9e2aaa8a537

Modified Files
--------------
src/backend/utils/cache/relcache.c |   10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Improve relcache invalidation handling of currently invisible re
Next
From: Andres Freund
Date:
Subject: pgsql: Improve relcache invalidation handling of currently invisible re