On Tue, Dec 15, 2015 at 11:08 AM, Andres Freund <andres@anarazel.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