On 05/01/2019 16:42, Alvaro Herrera wrote:
>> Yeah. Actually, we already have a solution of this in pg_basebackup,
>> with a bool success variable. I rewrote it like that. At least it's
>> better for uniformity.
>
> Ah, yeah, much better, LGTM.
>
>> I also added an atexit() conversion in isola
On 2019-Jan-05, Peter Eisentraut wrote:
> On 04/01/2019 20:35, Alvaro Herrera wrote:
> >> + /* prevent cleanup */
> >> + made_new_pgdata = found_existing_pgdata = made_new_xlogdir =
> >> found_existing_xlogdir = false;
> >> +
> >>return 0;
> >> }
> >
> > This is a bit ugly, but meh.
>
>
On 04/01/2019 20:35, Alvaro Herrera wrote:
> Seems you're registering the atexit cb twice here; you should only do so
> in the first "!conn" block.
OK, fixed.
>> @@ -3438,5 +3437,8 @@ main(int argc, char *argv[])
>>
>> destroyPQExpBuffer(start_db_cmd);
>>
>> +/* prevent cleanup */
>>
On Fri, Jan 04, 2019 at 04:35:51PM -0300, Alvaro Herrera wrote:
> On 2018-Dec-29, Peter Eisentraut wrote:
>> @@ -3438,5 +3437,8 @@ main(int argc, char *argv[])
>>
>> destroyPQExpBuffer(start_db_cmd);
>>
>> +/* prevent cleanup */
>> +made_new_pgdata = found_existing_pgdata = made_ne
On 2018-Dec-29, Peter Eisentraut wrote:
> @@ -387,6 +388,7 @@ StreamLog(void)
> if (!conn)
> /* Error message already written in GetConnection() */
> return;
> + atexit(disconnect_atexit);
>
> if (!CheckServerVersionForStreaming(conn))
> {
Seems
initdb and pg_basebackup can use atexit() to register cleanup actions
instead of requiring the use of custom exit_nicely() etc. Patches attached.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 6adbf8bfd67024