Lists: | pgsql-hackers |
---|
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_upgrade exit_nicely() |
Date: | 2011-03-31 20:31:33 |
Message-ID: | 1301603493.9296.28.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
While reading around in pg_upgrade code I came across the slightly
bizarre function
void exit_nicely(bool need_cleanup)
The parameter doesn't actually determine whether any cleanup is done.
The "cleanup" is done anyway and the parameter only controls the exit
code in a backwards way.
Also most of the cleanup appears to be useless, because you don't need
to close files or free memory before the program exits.
I figured this could be written more cleanly with an exit hook, so here
is a patch. I don't care much whether this patch is for now or later,
just wanted to throw it out there.
Attachment | Content-Type | Size |
---|---|---|
pgupgrade-exit.diff | text/x-patch | 5.2 KB |
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: pg_upgrade exit_nicely() |
Date: | 2011-03-31 20:54:15 |
Message-ID: | 201103312054.p2VKsFR28954@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Feel free to apply this to HEAD.
---------------------------------------------------------------------------
Peter Eisentraut wrote:
> While reading around in pg_upgrade code I came across the slightly
> bizarre function
>
> void exit_nicely(bool need_cleanup)
>
> The parameter doesn't actually determine whether any cleanup is done.
> The "cleanup" is done anyway and the parameter only controls the exit
> code in a backwards way.
>
> Also most of the cleanup appears to be useless, because you don't need
> to close files or free memory before the program exits.
>
> I figured this could be written more cleanly with an exit hook, so here
> is a patch. I don't care much whether this patch is for now or later,
> just wanted to throw it out there.
>
[ Attachment, skipping... ]
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +