]> granicus.if.org Git - postgresql/commit
Enable logical slots to follow timeline switches
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 30 Mar 2016 23:07:05 +0000 (20:07 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 30 Mar 2016 23:07:05 +0000 (20:07 -0300)
commit24c5f1a103ce6656a5cb430d9a996c34e61ab2a5
treec55425aba03671efba7b59497f9fad55d021411a
parent3b02ea4f0780ccce7dc116010201dad7ee50a401
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
16 files changed:
src/backend/access/transam/xlogreader.c
src/backend/access/transam/xlogutils.c
src/backend/replication/logical/logicalfuncs.c
src/include/access/xlogreader.h
src/test/modules/Makefile
src/test/modules/test_slot_timelines/.gitignore [new file with mode: 0644]
src/test/modules/test_slot_timelines/Makefile [new file with mode: 0644]
src/test/modules/test_slot_timelines/README [new file with mode: 0644]
src/test/modules/test_slot_timelines/expected/load_extension.out [new file with mode: 0644]
src/test/modules/test_slot_timelines/sql/load_extension.sql [new file with mode: 0644]
src/test/modules/test_slot_timelines/test_slot_timelines--1.0.sql [new file with mode: 0644]
src/test/modules/test_slot_timelines/test_slot_timelines.c [new file with mode: 0644]
src/test/modules/test_slot_timelines/test_slot_timelines.conf [new file with mode: 0644]
src/test/modules/test_slot_timelines/test_slot_timelines.control [new file with mode: 0644]
src/test/recovery/Makefile
src/test/recovery/t/006_logical_decoding_timelines.pl [new file with mode: 0644]