Re: [PATCH] xlogreader: do not read a file block twice - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] xlogreader: do not read a file block twice
Date
Msg-id 20190214065156.GE2366@paquier.xyz
Whole thread Raw
In response to Re: [PATCH] xlogreader: do not read a file block twice  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
Responses Re: [PATCH] xlogreader: do not read a file block twice  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
List pgsql-hackers
On Tue, Feb 12, 2019 at 11:44:14AM +0300, Arthur Zakirov wrote:
> Of course. Agree, it may be a non trivial case. Added as a bug fix:
> https://commitfest.postgresql.org/22/1994/

I have been looking at the patch, and I agree that the current coding
is a bit crazy.  If the wanted data has already been read, it makes
little sense to require reading it again if the size requested by the
caller of ReadPageInternal() exactly equals what has been read
already, and that's what the code is doing.

Now I don't actually agree that this qualifies as a bug fix.  As
things stand, a page may finish by being more than once if what has
been read previously equals what is requested, however this does not
prevent the code to work correctly.  The performance gain is also
heavily dependent on the callback reading a page and the way the WAL
reader is used.  How do you actually read WAL pages in your own
plugin with compressed data?  It begins by reading a full page once,
then it moves on to a per-record read after making sure that the page
has been read?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Making all nbtree entries unique by having heap TIDs participatein comparisons
Next
From: Michael Paquier
Date:
Subject: Re: Incorrect visibility test function assigned to snapshot