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
signature.asc
Description: PGP signature