Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present
Date
Msg-id 6f0d2862-d33c-9ede-1fd2-fc99fc51a2c5@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present  (Michael Banck <michael.banck@credativ.de>)
Responses Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present
List pgsql-hackers
On 9/11/17 03:11, Michael Banck wrote:
>> Is there a race condition here?  The slot is created after the checkpoint
>> is completed.  But you have to start streaming from the LSN where the
>> checkpoint started, so shouldn't the slot be created before the checkpoint
>> is started?
> 
> So my patch only moves the slot creation slightly further forward,
> AFAICT.
> 
> 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.

Maybe there is an argument to be made here about whether this is correct
or not, but why bother and risk the fragility?  Why not create the
replication slot first thing.  I would put it after the server version
checks and before we write recovery.conf.

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


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

pgsql-hackers by date:

Previous
From: Jeevan Chalke
Date:
Subject: Re: [HACKERS] Partition-wise aggregation/grouping
Next
From: Tatsuro Yamada
Date:
Subject: Re: [HACKERS] CLUSTER command progress monitor