From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix and improve cache invalidation logic for logical decoding. |
Date: | 2014-11-13 19:44:01 |
Message-ID: | E1Xp0JF-0000Y2-ET@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix and improve cache invalidation logic for logical decoding.
There are basically three situations in which logical decoding needs
to perform cache invalidation. During/After replaying a transaction
with catalog changes, when skipping a uninteresting transaction that
performed catalog changes and when erroring out while replaying a
transaction. Unfortunately these three cases were all done slightly
differently - partially because 8de3e410fa, which greatly simplifies
matters, got committed in the midst of the development of logical
decoding.
The actually problematic case was when logical decoding skipped
transaction commits (and thus processed invalidations). When used via
the SQL interface cache invalidation could access the catalog - bad,
because we didn't set up enough state to allow that correctly. It'd
not be hard to setup sufficient state, but the simpler solution is to
always perform cache invalidation outside a valid transaction.
Also make the different cache invalidation cases look as similar as
possible, to ease code review.
This fixes the assertion failure reported by Antonin Houska in
53EE02D9(dot)7040702(at)gmail(dot)com(dot) The presented testcase has been expanded
into a regression test.
Backpatch to 9.4, where logical decoding was introduced.
Branch
------
REL9_4_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/11868e1704cae36ee13303eaf9f5f5f656870426
Modified Files
--------------
contrib/test_decoding/Makefile | 2 +-
.../test_decoding/expected/decoding_into_rel.out | 84 ++++++++++++++++++++
contrib/test_decoding/sql/decoding_into_rel.sql | 27 +++++++
src/backend/replication/logical/reorderbuffer.c | 81 ++++++++++---------
4 files changed, 152 insertions(+), 42 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-11-13 23:20:03 | pgsql: Fix pg_dumpall to restore its ability to dump from ancient serve |
Previous Message | Andres Freund | 2014-11-13 19:43:52 | pgsql: Fix and improve cache invalidation logic for logical decoding. |