Re: Use atexit() in initdb and pg_basebackup

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use atexit() in initdb and pg_basebackup
Date: 2019-01-05 14:44:11
Message-ID: 3d072ada-198a-f5ee-8769-bc51823d4f19@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 */
>> + made_new_pgdata = found_existing_pgdata = made_new_xlogdir = found_existing_xlogdir = false;
>> +
>> return 0;
>> }
>
> This is a bit ugly, but meh.

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.

I also added an atexit() conversion in isolationtester. It's mostly the
same thing.

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

Attachment Content-Type Size
v2-0001-pg_basebackup-Use-atexit.patch text/plain 23.1 KB
v2-0002-initdb-Use-atexit.patch text/plain 9.8 KB
v2-0003-isolationtester-Use-atexit.patch text/plain 5.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-05 14:53:31 Re: [PATCH] Log PostgreSQL version number on startup
Previous Message Tomas Vondra 2019-01-05 14:21:03 Re: jsonpath