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

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, 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-21 17:39:58
Message-ID: 50AD11EE.80605@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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().

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
Web: http://www.postgresql-support.de
http://www.postgresql.at/

Attachment Content-Type Size
03-pg_malloc-unified-v2.patch text/x-patch 36.8 KB
04-tarutils-v2.patch text/x-patch 22.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-11-21 17:54:30 Re: [PATCH] binary heap implementation
Previous Message Jeff Janes 2012-11-21 17:10:12 Re: PANIC: could not write to log file