Re: mdnblocks() sabotages error checking in _mdfd_getseg()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: mdnblocks() sabotages error checking in _mdfd_getseg()
Date: 2015-12-15 16:28:10
Message-ID: CA+TgmobkkAEKPTsvgr87RvqXXXCcfqKowPWZ_9ugH8spmnJgrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 15, 2015 at 11:08 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> However, I don't think this is exactly what you are proposing. I'm
>> skeptical of the idea that _mdfd_getseg() should probe ahead to see
>> whether we're dealing with a malformed relation where the intermediate
>> segments still exist but have zero length.
>
> That's not exactly what I was thinking of. I'm was thinking of doing a
> _mdnblocks(reln, forknum, v) == RELSEG_SIZE check in _mdfd_getseg()'s
> main loop, whenever nextsegno < targetseg. That'll make that check
> rather cheap. Which sounds pretty much like your 2).

Hmm, yes it does. But now that I think about it, we're not otherwise
doing _mdnblocks() in that loop. So that would add a system call per
loop iteration. That doesn't seem like such a swell idea.

If you're OK with it, I think I'll commit the original patch. That
seems like a good thing to do regardless of what we decide about the
rest of this.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-12-15 16:40:31 Re: mdnblocks() sabotages error checking in _mdfd_getseg()
Previous Message Andres Freund 2015-12-15 16:08:29 Re: mdnblocks() sabotages error checking in _mdfd_getseg()