Re: fsync-pgdata-on-recovery tries to write to more files than previously

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Christoph Berg <myon(at)debian(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: fsync-pgdata-on-recovery tries to write to more files than previously
Date: 2015-05-28 21:37:16
Message-ID: 5740.1432849036@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com> writes:
> Here's an updated patch for the fsync problem(s).

I've committed this after some mostly-cosmetic rearrangements.

> 4. As a partial aside, why does fsync_fname use OpenTransientFile? It
> looks like it should use BasicOpenFile as pre_sync_fname does. We
> close the fd immediately after calling fsync anyway. Or is there
> some reason I'm missing that we should use OpenTransientFile in
> pre_sync_fname too?

pre_sync_fname is the one that is wrong IMO. Using BasicOpenFile just
creates an opportunity for problems; that function should get called
from as few places as possible.

> 5. I made walktblspc_entries use stat() instead of lstat(), so that we
> can handle symlinks and directories the same way. Note that we won't
> continue to follow links inside the sub-directories because we use
> walkdir instead of recursing.

Given that, walktblspc_entries was 99% duplicate, so I folded it into
walkdir with a process_symlinks boolean.

I have to leave shortly, so I'll look at the initdb cleanup tomorrow.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-05-28 21:37:43 Re: Free indexed_tlist memory explicitly within set_plan_refs()
Previous Message Jim Nasby 2015-05-28 21:35:57 Re: PGCon hacker lounge