Re: Use atexit() in initdb and pg_basebackup

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Use atexit() in initdb and pg_basebackup
Дата
Msg-id 201901041935.aqi5ogzbyiak@alvherre.pgsql
обсуждение исходный текст
Ответ на Use atexit() in initdb and pg_basebackup  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: Use atexit() in initdb and pg_basebackup  (Michael Paquier <michael@paquier.xyz>)
Re: Use atexit() in initdb and pg_basebackup  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
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 you're registering the atexit cb twice here; you should only do so
in the first "!conn" block.

It would be nicer to be able to call atexit() in GetConnection() instead
of at each callsite, but that would require a place to save each conn
struct into, which is probably more work than warranted.

> @@ -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.

Other than the first point, LGTM.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Arrays of domain returned to client as non-builtin oiddescribing the array, not the base array type's oid
Следующее
От: Tom Lane
Дата:
Сообщение: Re: "SELECT ... FROM DUAL" is not quite as silly as it appears