Re: [PATCH] Make pg_basebackup configure and start standby [Review]

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby [Review]
Date: 2012-11-22 16:57:01
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2012-11-22 11:06 keltezéssel, Boszormenyi Zoltan írta:
> Hi,
> 2012-11-21 18:39 keltezéssel, Boszormenyi Zoltan írta:
>> 2012-11-21 15:29 keltezéssel, Tom Lane írta:
>>> Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
>>>> pg_basebackup needs pg_malloc() to call disconnect_and_exit(1)
>>>> instead to quit cleanly and not leave an "unexpected EOF from client"
>>>> message in the server log. Which is a macro at the moment, but
>>>> has to be turned into a real function for the reasons below.
>>> man 2 atexit
>> It doesn't really help to make it easier. E.g: pg_strdup() in psql does this:
>> char *
>> pg_strdup(const char *string)
>> {
>> char *tmp;
>> if (!string)
>> {
>> psql_error("%s: pg_strdup: cannot duplicate null pointer (internal
>> error)\n",
>> pset.progname);
>> exit(EXIT_FAILURE);
>> }
>> tmp = strdup(string);
>> if (!tmp)
>> {
>> psql_error("out of memory\n");
>> exit(EXIT_FAILURE);
>> }
>> return tmp;
>> }
>> The function passed to atexit() still needs to know which string to print
>> and this needs an internal variable. Also, the actions taken on pg_malloc/pg_strdup
>> errors don't produce the exact same messages.
>> This is why I suggest the attached 03-pg_malloc-unified-v2.patch.
>> The 04-tarutils-v2.patch unifies the common tar functions and the string functions
>> like print_val() used by _tarCreateHeader (previously _tarWriteHeader) and
>> escape_quotes().
> The PQconninfo patch grew its own mail thread (this is why
> there's no 1st patch in this series now) and I reworked the order
> of the patches to make it more logical. This made the pg_basebackup
> patch 5K smaller.

The changes here are:

02-pg_malloc-unified-v4.1.patch: fixed crashing PQfinish() at exit time
in pg_basebackup, added the atexit() initializer to pg_receivexlog

03-tarutils-strutils-v3.1.patch: rebased to avoid fuzz in patching

04-pg_basebackup-v18.1.patch: use Magnus' PQconninfo patch
and filter the PQconninfoOption array internally, also rebased

> Best regards,
> Zoltán Böszörményi

Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria

Attachment Content-Type Size
02-pg_malloc-unified-v4.1.patch text/x-patch 37.2 KB
03-tarutils-strutils-v3.1.patch text/x-patch 16.9 KB
04-pg_basebackup-v18.1.patch text/x-patch 15.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-11-22 17:07:58 Re: pg_trgm partial-match
Previous Message Fujii Masao 2012-11-22 16:39:26 Re: Proposal for Allow postgresql.conf values to be changed via SQL