[PATCH] pg_upgrade: Split off pg_fatal() from pg_log()

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()
Date: 2013-09-13 02:50:42
Message-ID: 1379040642.8575.6.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The experiences with elog() and ereport() have shown that having one
function that can return or not depending on some log level parameter
isn't a good idea when you want to communicate well with the compiler.
In pg_upgrade, there is a similar case with the pg_log() function.
Since that isn't a public API, I'm proposing to change it and introduce
a separate function pg_fatal() for those cases where the calls don't
return.

Attachment Content-Type Size
0001-pg_upgrade-Split-off-pg_fatal-from-pg_log.patch text/x-patch 50.7 KB

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()
Date: 2013-09-15 16:27:49
Message-ID: 5235E005.7070601@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Peter,

On 2013-09-13 04:50, Peter Eisentraut wrote:
> The experiences with elog() and ereport() have shown that having one
> function that can return or not depending on some log level parameter
> isn't a good idea when you want to communicate well with the compiler.
> In pg_upgrade, there is a similar case with the pg_log() function.
> Since that isn't a public API, I'm proposing to change it and introduce
> a separate function pg_fatal() for those cases where the calls don't
> return.

I think the reasoning behind this patch is sound. However, I would like
to raise a couple of small questions:

1) Is there a reason for the fmt string not being const char*? You
changed it for pg_log_v(), but not for pg_log() and pg_fatal().
2) Allowing PG_FATAL to be passed to pg_log() seems weird, but I
don't feel strongly about that.

Other than that, the patch looks good to me.

Regards,
Marko Tiikkaja


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()
Date: 2013-09-26 21:56:38
Message-ID: 20130926215638.GC7113@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 12, 2013 at 10:50:42PM -0400, Peter Eisentraut wrote:
> The experiences with elog() and ereport() have shown that having one
> function that can return or not depending on some log level parameter
> isn't a good idea when you want to communicate well with the compiler.
> In pg_upgrade, there is a similar case with the pg_log() function.
> Since that isn't a public API, I'm proposing to change it and introduce
> a separate function pg_fatal() for those cases where the calls don't
> return.

Fine with me.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()
Date: 2013-10-02 01:33:39
Message-ID: 1380677619.22785.21.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, 2013-09-15 at 18:27 +0200, Marko Tiikkaja wrote:
> I think the reasoning behind this patch is sound. However, I would like
> to raise a couple of small questions:
>
> 1) Is there a reason for the fmt string not being const char*? You
> changed it for pg_log_v(), but not for pg_log() and pg_fatal().

Good catch. I think I just left the existing code alone. I'll fix it.

> 2) Allowing PG_FATAL to be passed to pg_log() seems weird, but I
> don't feel strongly about that.

Yeah, it's a bit weird. It's just because it all ends up in pg_log_v().
We could have pg_log() error about it, but that seems a bit excessive.
It's not a public API or anything.


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()
Date: 2013-10-09 18:51:48
Message-ID: CA+TgmobHPJejPRhOUbBDYV2suG8PO_tVKJ9ErX+GWfcnJOkC2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Oct 1, 2013 at 9:33 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On Sun, 2013-09-15 at 18:27 +0200, Marko Tiikkaja wrote:
>> I think the reasoning behind this patch is sound. However, I would like
>> to raise a couple of small questions:
>>
>> 1) Is there a reason for the fmt string not being const char*? You
>> changed it for pg_log_v(), but not for pg_log() and pg_fatal().
>
> Good catch. I think I just left the existing code alone. I'll fix it.
>
>> 2) Allowing PG_FATAL to be passed to pg_log() seems weird, but I
>> don't feel strongly about that.
>
> Yeah, it's a bit weird. It's just because it all ends up in pg_log_v().
> We could have pg_log() error about it, but that seems a bit excessive.
> It's not a public API or anything.

Since there are several votes in favor of this patch and none opposed,
I'm marking it Ready for Committer.

Peter, do you plan to commit it?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company