pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Enable logical slots to follow timeline switches
Date: Wed, 30 Mar 2016 23:09:03 +0000
Message-ID: <E1alPEV-0008SA-Q1@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Enable logical slots to follow timeline switches

When decoding from a logical slot, it's necessary for xlog reading to be
able to read xlog from historical (i.e. not current) timelines;
otherwise, decoding fails after failover, because the archives are in
the historical timeline.  This is required to make "failover logical
slots" possible; it currently has no other use, although theoretically
it could be used by an extension that creates a slot on a standby and
continues to replay from the slot when the standby is promoted.

This commit includes a module in src/test/modules with functions to
manipulate the slots (which is not otherwise possible in SQL code) in
order to enable testing, and a new test in src/test/recovery to ensure
that the behavior is as expected.

Author: Craig Ringer
Reviewed-By: Oleksii Kliukin, Andres Freund, Petr JelĂ­nek

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/24c5f1a103ce6656a5cb430d9a996c34e61ab2a5

Modified Files
--------------
src/backend/access/transam/xlogreader.c            |   9 +
src/backend/access/transam/xlogutils.c             | 244 +++++++++++++++--
src/backend/replication/logical/logicalfuncs.c     |  17 +-
src/include/access/xlogreader.h                    |  18 ++
src/test/modules/Makefile                          |   1 +
src/test/modules/test_slot_timelines/.gitignore    |   3 +
src/test/modules/test_slot_timelines/Makefile      |  22 ++
src/test/modules/test_slot_timelines/README        |  19 ++
.../expected/load_extension.out                    |  19 ++
.../test_slot_timelines/sql/load_extension.sql     |   7 +
.../test_slot_timelines--1.0.sql                   |  16 ++
.../test_slot_timelines/test_slot_timelines.c      | 133 +++++++++
.../test_slot_timelines/test_slot_timelines.conf   |   2 +
.../test_slot_timelines.control                    |   5 +
src/test/recovery/Makefile                         |   2 +
.../recovery/t/006_logical_decoding_timelines.pl   | 304 +++++++++++++++++++++
16 files changed, 790 insertions(+), 31 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (9+ messages)  latest in thread

Message-ID: <E1alPEV-0008SA-Q1@gemulon.postgresql.org>
Permalink:  ../E1alPEV-0008SA-Q1@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1alPEV-0008SA-Q1@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: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Enable logical slots to follow timeline switches
  In-Reply-To: <E1alPEV-0008SA-Q1@gemulon.postgresql.org>
  References: <E1alPEV-0008SA-Q1@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