pgsql: Fix logical replication slot initialization

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix logical replication slot initialization
Date: 2018-08-01 22:11:15
Message-ID: E1fkzKt-0003gA-NY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix logical replication slot initialization

This was broken in commit 9c7d06d60680, which inadvertently gave the
wrong value to fast_forward in one StartupDecodingContext call. Fix by
flipping the value. Add a test for the obvious error, namely trying to
initialize a replication slot with an nonexistent output plugin.

While at it, move the CreateDecodingContext call earlier, so that any
errors are reported before sending the CopyBoth message.

Author: Dave Cramer <davecramer(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/CADK3HHLVkeRe1v4P02-5hj55H3_yJg3AEtpXyEY5T3wuzO2jSg@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7326a7d63801673d3569def65cb7955d6486f254

Modified Files
--------------
contrib/test_decoding/expected/slot.out | 2 ++
contrib/test_decoding/sql/slot.sql | 2 ++
src/backend/replication/logical/logical.c | 2 +-
src/backend/replication/walsender.c | 23 +++++++++++++----------
4 files changed, 18 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2018-08-01 22:41:34 Re: pgsql: Use signals for postmaster death on Linux.
Previous Message Alvaro Herrera 2018-08-01 21:05:51 pgsql: Fix unnoticed variable shadowing in previous commit