Re: Create replication slot in pg_basebackup if requested and not yet present

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Michael Banck <michael(dot)banck(at)credativ(dot)de>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Create replication slot in pg_basebackup if requested and not yet present
Date: 2017-09-27 14:10:46
Message-ID: 2b9bf75b-23b9-bb29-8e0a-9f8b8046408e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/11/17 03:11, Michael Banck wrote:
> So my patch only moves the slot creation slightly further forward,
> AFAICT.

I have committed this patch, along with some associated cleanup.

> AIUI, wal streaming always begins at last checkpoint and from my tests
> the restart_lsn of the created replication slot is also before that
> checkpoint's lsn. However, I hope somebody more familiar with the
> WAL/replication slot code could comment on that. What I dropped in the
> refactoring is the RESERVE_WAL that used to be there when the temporary
> slot gets created, I have readded that now.

I had to make some changes to that, because the way your patch was
written it would use RESERVE_WAL also for the calls from pg_receivewal
--create-slot, which would have been a behavior change. So I added
another argument to CreateReplicationSlot() to control that.

> I also added a TAP test case that tries to check that the restart_lsn is
> lower than the checkpoint_lsn, which appears to be the case.

I think that test was written incorrectly, because it didn't actually
check the $checkpoint_lsn that it read. I have not included that test
in the committed patch. Feel free to send another patch if you want to
add more or different tests.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2017-09-27 14:28:49 Re: Logical Replication - test_decoding - unchanged-toast-datum
Previous Message Jesper Pedersen 2017-09-27 13:56:26 Re: Multicolumn hash indexes