Re: incorrect xlog.c coverage report

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: incorrect xlog.c coverage report
Date: 2018-11-22 01:42:42
Message-ID: CAEepm=1ndDH0iOa0=dRtJuFJ088PXQSj8j6Wnqo5KBijg+7PyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 22, 2018 at 2:22 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Wed, Nov 21, 2018 at 01:20:48PM -0500, Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> >> I think we should change all calls of ->teardown_node to ->stop(),
> >> except the one in the END block, and look for places which are currently
> >> relying too much on END (i.e. add more ->stop() calls where needed).
> >
> > Hm. We probably don't want to have zero coverage of immediate stop mode,
> > though I agree we could cut it way back.
>
> The root of the issue is that gcov is not able to write out the gcda
> file when Postgres is stopped in immediate mode? There are some code
> paths in the recovery tests where teardown_node is used on purpose (see
> for example 009_twophase.pl).

So the issue is that quickdie() uses _exit(), so the GCOV atexit()
handler (or whatever similar mechanism they use for that) doesn't run,
right?
Presumably you could add your own call to __gcov_flush() in
quickdie(), so that we get GCOV data but no other atexit()-like stuff.
I see that some people advocate doing that in signal handlers, but I
don't know if it's really safe. If that is somehow magically OK,
you'd probably also need the chdir() hack from proc_exit() to get
per-pid files.

--
Thomas Munro
http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2018-11-22 01:56:39 Re: incorrect xlog.c coverage report
Previous Message Michael Paquier 2018-11-22 01:21:53 Re: incorrect xlog.c coverage report