Re: Small race in pg_xlogdump --follow

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small race in pg_xlogdump --follow
Date: 2016-09-30 09:19:07
Message-ID: CABUevEzBFutx6piBKu0EOcUDJ18BzgiQAiZ5zMV=HWXg2WSDog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 26, 2016 at 3:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Magnus Hagander <magnus(at)hagander(dot)net> writes:
> > Oh, right, at the very last loop. I've never seen it need more than 1
> loop
> > so I didn't manage to hit that codepath :) But yeah, saving errno and
> > restoring it on the other side of pg_usleep is probably a good idea.
>
> Right. On a larger scale --- I'm too uncaffeinated to figure out whether
> this is the code path taken for the initially user-supplied file name.
> But it would be unfriendly if when you fat-finger the command line
> arguments, it takes 5 seconds for pg_xlogdump to tell you so. Maybe
> the looping behavior should only happen on non-first file access.
>

It's a different codepath, so the retry does not happen on that. Different
error message, even. ("could not open file" vs "could not find file").

I'll go commit this including a source code comment about why the loop is
there that was missing.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Kellerer 2016-09-30 09:40:24 Re: pg_upgrade from 9.5 to 9.6 fails with "invalid argument"
Previous Message Michael Paquier 2016-09-30 09:13:56 Re: Fix checkpoint skip logic on idle systems by tracking LSN progress