pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Handle heap rewrites even better in logical decoding
Date: Wed, 21 Mar 2018 13:19:23 +0000
Message-ID: <E1eydeF-0006Lw-JT@gemulon.postgresql.org> (raw)

Handle heap rewrites even better in logical decoding

Logical decoding should not publish anything about tables created as
part of a heap rewrite during DDL.  Those tables don't exist externally,
so consumers of logical decoding cannot do anything sensible with that
information.  In ab28feae2bd3d4629bd73ae3548e671c57d785f0, we worked
around this for built-in logical replication, but that was hack.

This is a more proper fix: We mark such transient heaps using the new
field pg_class.relwrite, linking to the original relation OID.  By
default, we ignore them in logical decoding before they get to the
output plugin.  Optionally, a plugin can register their interest in
getting such changes, if they handle DDL specially, in which case the
new field will help them get information about the actual table.

Reviewed-by: Craig Ringer <craig@2ndquadrant.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/325f2ec5557fd1c9156c910102522e04cb42d99c

Modified Files
--------------
.../test_decoding/expected/concurrent_ddl_dml.out  | 82 ++++++++--------------
contrib/test_decoding/expected/ddl.out             | 20 +++---
.../test_decoding/specs/concurrent_ddl_dml.spec    |  2 +-
contrib/test_decoding/sql/ddl.sql                  |  5 +-
contrib/test_decoding/test_decoding.c              | 14 ++++
doc/src/sgml/catalogs.sgml                         | 12 ++++
doc/src/sgml/logicaldecoding.sgml                  |  5 ++
src/backend/bootstrap/bootparse.y                  |  1 +
src/backend/catalog/heap.c                         |  4 ++
src/backend/catalog/toasting.c                     |  1 +
src/backend/commands/cluster.c                     |  1 +
src/backend/commands/tablecmds.c                   |  1 +
src/backend/replication/logical/logical.c          |  4 ++
src/backend/replication/logical/reorderbuffer.c    |  7 ++
src/backend/replication/pgoutput/pgoutput.c        | 26 -------
src/include/catalog/catversion.h                   |  2 +-
src/include/catalog/heap.h                         |  1 +
src/include/catalog/pg_class.h                     | 22 +++---
src/include/replication/output_plugin.h            |  1 +
src/include/replication/reorderbuffer.h            |  5 ++
20 files changed, 113 insertions(+), 103 deletions(-)



Message-ID: <E1eydeF-0006Lw-JT@gemulon.postgresql.org>
Permalink:  ../E1eydeF-0006Lw-JT@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eydeF-0006Lw-JT@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: Handle heap rewrites even better in logical decoding
  In-Reply-To: <E1eydeF-0006Lw-JT@gemulon.postgresql.org>
  References: <E1eydeF-0006Lw-JT@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox