Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-01-13 22:40:32 +0200, Heikki Linnakangas wrote:
>> I think it's more natural to return the empty page to the caller, rather
>> than InvalidBuffer.
> Hm. I don't see the advantage - and it makes it impossible to recognize
> that case at the caller level.
Huh? The caller can do PageIsNew if it needs to tell the difference.
If we always return InvalidBuffer, it *can't* tell the difference.
> I thought about that approach at first as well, but I am not so sure
> it's sufficient. Isn't it quite possible that we'd end up reading a page
> that was *partially* written during a crash and due to that has a
> corrupted checksum?
If we did, then either the master would also have failed (so we'd not
be here), or there's a discrepancy between master and slave data,
in which case we've got bigger problems than this.
The addition of a bufmgr function to only return an already-in-cache
page is a possible future performance enhancement, but I do not care
for it as a bug fix that has to be back-patched as far as 9.0.
regards, tom lane